Skip to content

Commit

Permalink
Added recursion control
Browse files Browse the repository at this point in the history
  • Loading branch information
ManiMozaffar committed May 7, 2023
1 parent 1e6515d commit 7ae065f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions worker/scraper/linkedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


async def scrape_linkedin(
worker_id: int, info=None,
worker_id: int, info=None, recursion_depth=0,
only_popular=False, headless=False, *args, **kwargs
):
"""
Expand Down Expand Up @@ -119,11 +119,12 @@ async def scrape_linkedin(

return
except helpers.PlayWrightTimeOutError:
pass
if recursion_depth < 5:
return await scrape_linkedin(
worker_id=worker_id, only_popular=only_popular,
headless=headless, recursion_depth=recursion_depth+1
)
except Exception as e:
loguru.logger.error(e)
finally:
return await scrape_linkedin(
worker_id=worker_id, only_popular=only_popular,
headless=headless
)
pass

0 comments on commit 7ae065f

Please sign in to comment.