From 0330edba246a296559cec99e8f523175a808c7fb Mon Sep 17 00:00:00 2001 From: Gaurav Sharma Date: Wed, 15 Feb 2023 16:57:09 +0530 Subject: [PATCH] added custom driver support in scrape function --- Scweet/scweet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Scweet/scweet.py b/Scweet/scweet.py index d541c79..821b4cd 100644 --- a/Scweet/scweet.py +++ b/Scweet/scweet.py @@ -13,7 +13,7 @@ def scrape(since, until=None, words=None, to_account=None, from_account=None, mention_account=None, interval=5, lang=None, headless=True, limit=float("inf"), display_type="Top", resume=False, proxy=None, hashtag=None, show_images=False, save_images=False, save_dir="outputs", filter_replies=False, proximity=False, - geocode=None, minreplies=None, minlikes=None, minretweets=None): + geocode=None, minreplies=None, minlikes=None, minretweets=None, driver=None): """ scrape data from twitter using requests, starting from until . The program make a search between each and until it reaches the date if it's given, else it stops at the actual date. @@ -68,7 +68,8 @@ def scrape(since, until=None, words=None, to_account=None, from_account=None, me if save_images == True: show_images = True # initiate the driver - driver = init_driver(headless, proxy, show_images) + if driver is None: + driver = init_driver(headless, proxy, show_images) # resume scraping from previous work if resume: since = str(get_last_date_from_csv(path))[:10]