chris-greening / instascrape

Powerful and flexible Instagram scraping library for Python, providing easy-to-use and expressive tools for accessing data programmatically
https://chris-greening.github.io/instascrape/
MIT License
630 stars 107 forks source link

Wrong profile_pic_url_hd and biography when passing SESSION_ID #90

Closed marco97pa closed 3 years ago

marco97pa commented 3 years ago

Describe the bug

If we pass a valid SESSION_ID cookie to the scraper, the values profile_pic_url_hd and biography of the Profile are wrong.

To Reproduce

Code

Run this code by providing a valid instagram_sessionid

from instascrape import *

instagram_sessionid = 'xxxxx'
headers = {"user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36 Edg/87.0.664.57",
"cookie": f"sessionid={instagram_sessionid};"}

profile = Profile("roses_are_rosie")
profile.scrape(headers=headers)
print(profile.profile_pic_url_hd)
print(profile.biography)

Expected output

We expect the output to print the profile pic url and biography of @roses_are_rosie:

https://scontent-fco1-1.cdninstagram.com/v/t51.2885-19/s320x320/120911233_113942167015019_7757793538086741578_n.jpg?_nc_ht=scontent-fco1-1.cdninstagram.com&_nc_ohc=vLiuePti8-oAX81KArw&tp=1&oh=6347fbcf84fa8021ca0f427c4b355573&oe=604ABB41
ROSÉ

Output

Instead we got the profile pic url and the biography of the login account of the provided instagram_sessionid. In my specific case, it is printing the data of @puntiburraco Please be aware that the output depends on the login account you are using to scrape, but it's always wrong.

https://scontent-fco1-1.cdninstagram.com/v/t51.2885-19/s320x320/66284490_468664600594844_7307310439468105728_n.jpg?_nc_ht=scontent-fco1-1.cdninstagram.com&_nc_ohc=y6o_TmT3c6AAX9PGXzO&tp=1&oh=240222f677c66049485e2edad1d76c77&oe=604E1EC2
App Android
Segnapunti per le tue partite di Burraco
♠️♥️♣️♦️🃏

Tested on:

Additional context I understand that the latest changes of Instagram broke the library but we need more documentation on how to handle this new changes.

marco97pa commented 3 years ago

Fixed as instascrape 2.1.2