Added choices for headless yes or no, along with user-agent related changes

This commit is contained in:
ReptilianPride
2025-02-28 00:24:45 +00:00
parent ea112ad595
commit 04c8949e5b
3 changed files with 24 additions and 3 deletions

View File

@@ -44,6 +44,13 @@ def main():
default=os.getenv("TWITTER_PASSWORD"),
help="Your Twitter password.",
)
parser.add_argument(
"--headlessState",
type=str,
default=os.getenv("HEADLESS"),
help="Headless mode? [yes/no]"
)
except Exception as e:
print(f"Error retrieving environment variables: {e}")
sys.exit(1)
@@ -113,6 +120,7 @@ def main():
USER_MAIL = args.mail
USER_UNAME = args.user
USER_PASSWORD = args.password
HEADLESS_MODE= args.headlessState
if USER_UNAME is None:
USER_UNAME = input("Twitter Username: ")
@@ -120,6 +128,9 @@ def main():
if USER_PASSWORD is None:
USER_PASSWORD = getpass.getpass("Enter Password: ")
if HEADLESS_MODE is None:
HEADLESS_MODE - str(input("Headless?[Yes/No]")).lower()
print()
tweet_type_args = []
@@ -146,6 +157,7 @@ def main():
mail=USER_MAIL,
username=USER_UNAME,
password=USER_PASSWORD,
headlessState=HEADLESS_MODE
)
scraper.login()
scraper.scrape_tweets(