Skip to content

Instantly share code, notes, and snippets.

View pratik-dani's full-sized avatar
🎯
Focusing

Pratik Dani pratik-dani

🎯
Focusing
View GitHub Profile
import base64
import pickle
from email.mime.text import MIMEText
from googleapiclient.discovery import build
def create_message(sender, to, subject, message_text):
"""Create a message for an email.
Args:
sender: Email address of the sender.
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/gmail.send']
PATH = r"PATH_TO_JSON"
import requests
headers = {"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36",
}
company_link = 'https://www.linkedin.com/voyager/api/entities/companies/2652230'
with requests.session() as s:
s.cookies['li_at'] = "your li_at cookie"
s.cookies["JSESSIONID"] = "your JSESSIONID"
url = f"http://2captcha.com/res.php?key={api_key}&action=get&id={request_id}&json=1"
status = 0
while not status:
res = requests.get(url)
if res.json()['status']==0:
time.sleep(3)
else:
requ = res.json()['request']
js = f'document.getElementById("g-recaptcha-response").innerHTML="{requ}";'
site_key = "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
with open(r"api_key.txt", "r") as f:
api_key = f.read()
form = {"method": "userrecaptcha",
"googlekey": site_key,
"key": api_key,
"pageurl": pageurl,
"json": 1}
from selenium import webdriver
import requests
import time
pageurl = 'https://www.google.com/recaptcha/api2/demo'
driver = webdriver.Chrome(executable_path=r'chromedriver_win32\chromedriver.exe')
driver.get(pageurl)