Skip to content

Instantly share code, notes, and snippets.

@KaushikShresth07
Created September 9, 2023 11:27
Show Gist options
  • Save KaushikShresth07/b8469f6c27395cd105a1062b820c9b20 to your computer and use it in GitHub Desktop.
Save KaushikShresth07/b8469f6c27395cd105a1062b820c9b20 to your computer and use it in GitHub Desktop.
import pyperclip
import pyautogui
import webbrowser
from time import sleep
import json
import keyboard
def CookieScrapper():
webbrowser.open("https://bard.google.com")
sleep(2)
pyautogui.click()
sleep(1)
pyautogui.click()
sleep(1)
pyautogui.click()
sleep(1)
keyboard.press_and_release('ctrl + w')
data = pyperclip.paste()
try:
json_data = json.loads(data)
pass
except json.JSONDecodeError as e:
print(f"Error parsing JSON data: {e}")
SID = "__Secure-1PSID"
TS = "__Secure-1PSIDTS"
CC = "__Secure-1PSIDCC"
SIDValue = next((item for item in json_data if item["name"] == SID), None)
TSValue = next((item for item in json_data if item["name"] == TS), None)
CCValue = next((item for item in json_data if item["name"] == CC), None)
if SIDValue is not None:
SIDValue = SIDValue["value"]
else:
print(f"{SIDValue} not found in the JSON data.")
if TSValue is not None:
TSValue = TSValue["value"]
else:
print(f"{TSValue} not found in the JSON data.")
if CCValue is not None:
CCValue = CCValue["value"]
else:
print(f"{CCValue} not found in the JSON data.")
cookie_dict = {
"__Secure-1PSID": SIDValue ,
"__Secure-1PSIDTS": TSValue,
"__Secure-1PSIDCC": CCValue,
}
return cookie_dict
cookie_dict = CookieScrapper()
@MrTG1B
Copy link

MrTG1B commented Dec 24, 2023

image it is showing that this site does not have any cookies what to do?

@AnshumanSarkar2001
Copy link

@MrTG2004 You have downloaded the wrong extension. use this link EditThisCookie

@MrTG1B
Copy link

MrTG1B commented Dec 27, 2023

@MrTG2004 You have downloaded the wrong extension. use this link EditThisCookie

Thank you, but no, it is not. I didn't turn on the settings correctly. But thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment