'How can I get JSON package on indiegogo page?
I want to get the JSON package that contains the project description from 'https://www.indiegogo.com/explore/energy-green-tech?project_type=campaign&project_timing=all&sort=trending'. Then I opened the developer tool and got the parameters related to the post command. I use the requests package for crawling but I can't get the JSON package. I want to know what's wrong with my code.
import requests
cookies = {My cookies
}
headers = {
'authority': 'www.indiegogo.com',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"',
'x-locale': 'en',
'x-csrf-token': 'oaAkjjUu18/RhoiMobPlv8aQe/QmTaKb2tDwypHIrt4tTyjWMRTU8FjXzgjKKIEdKrCjK83yg4G8+gSyK6nuFg==',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36',
'content-type': 'application/json;charset=UTF-8',
'accept': 'application/json, text/plain, */*',
'sec-ch-ua-platform': '"Windows"',
'origin': 'https://www.indiegogo.com',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
'referer': 'https://www.indiegogo.com/explore/energy-green-tech?project_type=campaign&project_timing=all&sort=trending',
'accept-language': 'zh-CN,zh;q=0.9',
}
data = {
'{"sort":"trending","category_main":"Energy ': '',
' Green Tech","category_top_level":"Tech ': '',
' Innovation","project_timing":"all","project_type":"campaign","page_num":1,"per_page":12,"q":"","tags":[]}': ''
}
response = requests.get('https://www.indiegogo.com/private_api/discover', headers=headers, data=data, cookies=cookies)
print(response.json())
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
