marcopompili / django-instagram

Instagram application for Django.
BSD 3-Clause "New" or "Revised" License
76 stars 27 forks source link

requests.exceptions.HTTPError: 429 Client Error: - for url: https://www.instagram.com/accounts/login/ #30

Open NasirNS45 opened 3 years ago

NasirNS45 commented 3 years ago

Hi,

I am using django-instagram client for first time. I am using django 3.2. I following the usage example but on console there are error, Here is the log:

ERROR:root:user profile "mr.nasir.hussain45" not found Traceback (most recent call last): File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/django_instagram/scraper.py", line 28, in instagram_scrap_profile page.raise_for_status() File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 429 Client Error: - for url: https://www.instagram.com/accounts/login/ ERROR:root:scripts not found Traceback (most recent call last): File "/home/nasir-ns/Desktop/insta/venv/lib/python3.8/site-packages/django_instagram/scraper.py", line 44, in instagram_profile_js return tree.xpath('//script') AttributeError: 'NoneType' object has no attribute 'xpath'

Note (mr.nasir.hussain45 is a public profile)

NasirNS45 commented 3 years ago

Where are you guys ? I need your help

SimonHurst commented 3 years ago

Hey @NasirNS45 I think no one is answering because this doesn't work any more and no one can or has the inclination to fix it. Only reason I'm responding, as I don't use this anymore, is in the vain hope someones is offended enough by the accusation that this should be taken down. That they come and lend you a hand dude. ;)

marcopompili commented 3 years ago

Hey fellas, the problem is that Instagram started fighting scraping a few months ago, now they're pushing their API again (they killed it a few years ago, so back then scraping was the only option). I think scraping profile pages is against their TOS now (maybe because of bots or other similar things).

The error above is caused by Instagram redirecting to a login page probably by doing some client-detection on their end. Now for embedding IG content you have to go through their API, we can't go around that, also from a legal standpoint. To use the IG API within Django it would require a full rewrite of this app, but I don't even think if it would be useful at this point.

I'm going to put a warning saying that this extension is not supported atm.