driver initial setup
This commit is contained in:
2
.env.example
Normal file
2
.env.example
Normal file
@@ -0,0 +1,2 @@
|
||||
TWITTER_EMAIL=# Your Twitter Email
|
||||
TWITTER_PASSWORD=# Your Twitter Password
|
||||
89
main.ipynb
Normal file
89
main.ipynb
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import re\n",
|
||||
"import csv\n",
|
||||
"from fake_headers import Headers\n",
|
||||
"from getpass import getpass\n",
|
||||
"from time import sleep\n",
|
||||
"from selenium import webdriver\n",
|
||||
"from selenium.webdriver.common.keys import Keys\n",
|
||||
"from selenium.common.exceptions import NoSuchElementException, WebDriverException\n",
|
||||
"\n",
|
||||
"from selenium.webdriver.chrome.options import Options as ChromeOptions\n",
|
||||
"from selenium.webdriver.chrome.service import Service as ChromeService\n",
|
||||
"\n",
|
||||
"USER_EMAIL = os.environ['TWITTER_EMAIL']\n",
|
||||
"USER_PASSWORD = os.environ['TWITTER_PASSWORD']\n",
|
||||
"TWITTER_LOGIN_URL = \"https://twitter.com/i/flow/login\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 43,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"header = Headers().generate()['User-Agent']\n",
|
||||
"browser_option = ChromeOptions()\n",
|
||||
"browser_option.add_argument('--no-sandbox')\n",
|
||||
"browser_option.add_argument(\"--disable-dev-shm-usage\")\n",
|
||||
"browser_option.add_argument('--ignore-certificate-errors')\n",
|
||||
"browser_option.add_argument('--disable-gpu')\n",
|
||||
"browser_option.add_argument('--log-level=3')\n",
|
||||
"browser_option.add_argument('--disable-notifications')\n",
|
||||
"browser_option.add_argument('--disable-popup-blocking')\n",
|
||||
"browser_option.add_argument('--user-agent={}'.format(header))\n",
|
||||
"\n",
|
||||
"# For Hiding Browser\n",
|
||||
"# browser_option.add_argument(\"--headless\")\n",
|
||||
"\n",
|
||||
"driver = webdriver.Chrome(\n",
|
||||
" options=browser_option\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "ml",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.12"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user