Skip to content

Instantly share code, notes, and snippets.

@bertrandmartel
Last active June 12, 2020 01:39
Show Gist options
  • Save bertrandmartel/196db3a722023ff24aee18a290890612 to your computer and use it in GitHub Desktop.
Save bertrandmartel/196db3a722023ff24aee18a290890612 to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
s = requests.Session()
r = s.get("https://www.kickstarter.com")
soup = BeautifulSoup(r.text, 'html.parser')
xcsrf = soup.find("meta", {"name": "csrf-token"})["content"]
query = """
query GetEndedToLive($slug: String!) {
project(slug: $slug) {
id
deadlineAt
showCtaToLiveProjects
state
description
url
__typename
}
}"""
r = s.post("https://www.kickstarter.com/graph",
headers= {
"x-csrf-token": xcsrf
},
json = {
"query": query,
"variables": {
"slug":"kuhkubus-3d-escher-figures"
}
})
print(r.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment