【发布时间】:2019-02-04 14:26:49
【问题描述】:
我正在使用下面的帖子链接的方法来抓取 Instagram 个人资料。 我可以更改检索的图像数量吗?在 Json 响应中,我看到了“has_next_page”参数,但我不确定如何使用它。 提前致谢。 发帖链接: What is the new instagram json endpoint?
使用代码:
r = requests.get('https://www.instagram.com/' + profile + '/')
soup = BeautifulSoup(r.content)
scripts = soup.find_all('script', type="text/javascript",
text=re.compile('window._sharedData'))
stringified_json = scripts[0].get_text().replace('window._sharedData = ', '')[:-1]
data = json.loads(stringified_json)['entry_data']['ProfilePage'][0]
【问题讨论】:
-
Instagram 有一个 API,你应该使用它而不是试图抓取他们的网站。
标签: python web-scraping instagram