Skip to content

Commit

Permalink
Merge pull request frederikme#68 from euglv/chrome_profile_conf
Browse files Browse the repository at this point in the history
Configurable --user-data-dir parameter and fix for Windows
  • Loading branch information
frederikme authored Nov 15, 2021
2 parents 27cdee5 + 700b8f4 commit 517d643
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tinderbotz/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Session:

HOME_URL = "https://www.tinder.com/app/recs"

def __init__(self, headless=False, store_session=True, proxy=None):
def __init__(self, headless=False, store_session=True, proxy=None, user_data=False):
self.email = None
self.may_send_email = False
self.session_data = {
Expand Down Expand Up @@ -76,11 +76,13 @@ def cleanup():

# Create empty profile to avoid annoying Mac Popup
if store_session:
if not os.path.isdir(f'./chrome_profile'):
os.mkdir(f'./chrome_profile')
if not user_data:
user_data = f"{Path().absolute()}/chrome_profile/"
if not os.path.isdir(user_data):
os.mkdir(user_data)

Path(f'./chrome_profile/First Run').touch()
options.add_argument(f'--user-data-dir=./chrome_profile/')
Path(f'{user_data}First Run').touch()
options.add_argument(f"--user-data-dir={user_data}")

options.add_argument('--no-first-run --no-service-autorun --password-store=basic')
options.add_argument("--lang=en-GB")
Expand Down

0 comments on commit 517d643

Please sign in to comment.