#web scraping

1 messages · Page 1 of 1 (latest)

prisma bear
#

i am trying to scrape an instagram account but i'm not sure if am getting detected or am just doing it wrong here's the code i wrote

from seleniumbase import SB
with SB(uc=True, test=True) as sb:
    url = f'https://www.instagram.com/{username}/'
    sb.driver.uc_open_with_reconnect(url, 4)
    code = sb.driver.get_page_source()

soup = Soup(code, 'html.parser') #parse the html using lxml parser
section = soup.find('div', class_='x1gryazu xh8yej3 x10o80wk x14k21rp x17snn68 x6osk4m x1porb0y') #section that contains all the information about the user
print(section)
profile_url = section.find('img', class_='xpdipgo x972fbf xcfux6l x1qhh985 xm0m39n xk390pu x5yr21d xdj266r x11i5rnm xat24cr x1mh8g0r xl1xv1r xexx8yu x4uap5 x18d9i69 xkhd6sd x11njtxf xh8yej3')['href']
print(profile_url)
``` for the section it print out  ```py
none

and for the profile_url am getting an error

#
profile_url = section.find('img', class_='xpdipgo x972fbf xcfux6l x1qhh985 xm0m39n xk390pu x5yr21d xdj266r x11i5rnm xat24cr x1mh8g0r xl1xv1r xexx8yu x4uap5 x18d9i69 xkhd6sd x11njtxf xh8yej3')['href']
AttributeError: 'NoneType' object has no attribute 'find'
#

am confused if am getting detected

violet cloak
#

have you tried just printing out the entire html and see if your code is seeing what you think it is

prisma bear
#

Yes i had

prisma bear