Skip to content

Instantly share code, notes, and snippets.

@JPShag
Created August 17, 2025 20:21
Show Gist options
  • Save JPShag/f08880e534bc16658fa2ccaac6a541d8 to your computer and use it in GitHub Desktop.
Save JPShag/f08880e534bc16658fa2ccaac6a541d8 to your computer and use it in GitHub Desktop.
dogshit gemini.goole.com to api
import requests
url = 'https://gemini.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate?bl=boq_assistant-bard-web-server_20250814.06_p1&f.sid=-3000860039174278335'
# The Cookie is the most important. Copy these from your browser
headers = {
'Host': 'gemini.google.com',
'Cookie': 'PASTE_YOUR_ENTIRE_COOKIE_STRING_HERE',
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
'X-Same-Domain': '1'
}
# Payload
# Need to automate
form_data = {
'f.req': 'PASTE_THE_VERY_LONG_F.REQ_STRING_HERE'
}
# Make the POST request
try:
response = requests.post(url, headers=headers, data=form_data)
# Check if the request was successful
response.raise_for_status()
# The response is streamed and in a special format, not simple JSON.
# Parsing it would require additional logic to handle the length-prefixed chunks.
print("Request sent successfully!")
print("Raw Response:", response.text)
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment