0

I'm trying to use the insta-scrape library for python, specifically the method to get all posts of a instagram profile.

This is the link to the library page: https://pypi.org/project/insta-scrape/

This is the link to the library doc in particular for the method get_posts: https://instascrape.readthedocs.io/en/latest/instascrape.scrapers.html#module-instascrape.scrapers.profile

My simple code is :

options = Options()
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
insta_profile = Profile('https://www.instagram.com/molteni_matteo/')
insta_profile.scrape()
list_post = insta_profile.get_posts(webdriver=driver, amount=None,
                                      login_first=False, login_pause=60,
                                      max_failed_scroll=300, scrape=False, scrape_pause=5)
for profile_post in list_post:
    print(profile_post)

But it gives me the error :

error

How can i solve this problem ?

Matteo
  • 120
  • 10

1 Answers1

1

That's actually a bug in the python module, where Profile doesn't accept the url correctly. You can fix it by setting

insta_profile.url = 'https://www.instagram.com/molteni_matteo/'

before calling get_posts

Lukas Schmid
  • 1,895
  • 1
  • 6
  • 18
  • Thanks mate. Had this issue but I get the following error: `bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?` – flying_loaf_3 Feb 05 '21 at 00:35
  • You probably do need to install a parser library. – Lukas Schmid Feb 05 '21 at 20:19
  • https://stackoverflow.com/questions/24398302/bs4-featurenotfound-couldnt-find-a-tree-builder-with-the-features-you-requeste – Lukas Schmid Feb 05 '21 at 20:19