Web scraping but attribute comes back as none?

时间:2019-04-16 22:38:47

标签: python html web-scraping instagram

I'm trying to web-scrape off a link on an instagram post with users who have liked the post, but I get an error such as "AttributeError: 'NoneType' object has no attribute 'text'". Is the reason because I would have to scroll down to get to the bottom of the instagram likers list or a complete different reason? Link is below: https://imgur.com/PUMcGmR.

Link im trying to web scrape off: https://www.instagram.com/p/BwTq8jahWhD/liked_by/

Packages im using is beautifulsoup, lxml and requests.

Also pretty new to Python so any guidance would be greatly appreciated. Thank you!

from bs4 import BeautifulSoup
source = requests.get('https://www.instagram.com/p/BwTq8jahWhD/liked_by/').text
soup = BeautifulSoup(source, 'lxml')
body = soup.find('body')
clas = body.find('div', class_='RnEpo Yx5HN      ')             
print (clas)

0 个答案:

没有答案