Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用BeautifulSoup和python清除Instagram标签页_Python_Beautifulsoup - Fatal编程技术网

使用BeautifulSoup和python清除Instagram标签页

使用BeautifulSoup和python清除Instagram标签页,python,beautifulsoup,Python,Beautifulsoup,我按照BeautifulSoup教程从网站上获取信息,我需要从标签研究页面获取instagram帖子的链接,但我没有任何结果 url_tag = 'https://www.instagram.com/explore/tags/food' response_url_tag = get(url_tag) html_soup = BeautifulSoup(response_url_tag.text, 'html.parser') #print(html_soup.prettify()) for

我按照BeautifulSoup教程从网站上获取信息,我需要从标签研究页面获取instagram帖子的链接,但我没有任何结果

url_tag = 'https://www.instagram.com/explore/tags/food'
response_url_tag = get(url_tag)

html_soup = BeautifulSoup(response_url_tag.text, 'html.parser')
#print(html_soup.prettify())

for link in html_soup.find_all('a'):
    print(link.get('href'))

我怎样才能刮去所有的链接?我需要在代码中更改什么

您将无法使用BeautifulSoup执行此操作。原因是,与许多现代web应用程序一样,在浏览器的检查器中可以看到的链接不在html代码中,而是在浏览器中使用javascript呈现。 如果您卷曲URL,您将不会得到任何URL而不是HTML。然后你必须用python来解析它。政府是这样做的

或者,您可以使用为您包装这一切的示例