postaddictme / instagram-php-scraper

Get account information, photos, videos, stories and comments.
https://packagist.org/packages/raiym/instagram-php-scraper
MIT License
3.09k stars 800 forks source link

getMedias Is not working after last update #347

Closed tarangpatel61 closed 5 years ago

rhcarlosweb commented 6 years ago

325

tarangpatel61 commented 6 years ago

Hello rhcarlosweb Here i getting the error when i hit below link https://instagram.com/graphql/query/?query_id=17888483320059182&id=44291&first=30&after= It gives error Access to instagram.com was denied You don't have authorization to view this page. HTTP ERROR 403

despecial commented 6 years ago

You need to be logged in/authenticated

tarangpatel61 commented 6 years ago

Thank you its works fine!!!!!

Saiirex commented 6 years ago

@despecial is there a way to do it without authentication?

despecial commented 6 years ago

@Saiirex only if you scrape the normal profile page and extract the JSON array. (You will get the latest 12 medias, nothing else)

Saiirex commented 6 years ago

@despecial thats sad, i need all the media...

despecial commented 6 years ago

Then use the official API

Saiirex commented 6 years ago

Which one? Graph api?

engnaguib commented 6 years ago

@Saiirex https://developers.facebook.com/docs/instagram-api but you can't access the account without access token ,and must be business account

facreationz commented 6 years ago

So its official then.. anonymous scrapping is no longer possible without Instagram's own business account API.

bomboem commented 6 years ago

@itzfaraz Well that's a pitty, any chances in loading the userpage and actually retreiving all the objects?

facreationz commented 6 years ago

As already pointed out by many people, the Instagram has changed its API once again; it is now mandatory to work with all cookies that are returned on the first contact with www.instagram.com/{username}. But the bigger problem is query_hash code that has become IP and device specific and keeps changing on every session (I think). I've been able to dig down to a JavaScript file that is from https://www.instagram.com/static/bundles/base/ProfilePageContainer.js/{randomcode}.js which contains the query_hash code every time you create a new session. Even that file has 3 different query_hash code, not sure which one the scrapper should pick up for communication.

But keep in mind.. if your incognito/private mode web browser can communicate with Instagram without any user login, so can your application. Just need to figure out how to do it.

Instagram has made it's code very dynamic. The CSS stylesheets, linked files, script files, hash codes, etc. everything differs from session to session.

Saiirex commented 6 years ago

@itzfaraz is there a working solution right now?

pgrimaud commented 6 years ago

@itzfaraz @despecial @Saiirex I implement a way to fetch user feed without authentication using web scraping here : https://github.com/pgrimaud/instagram-user-feed.

How it works? I retrieve the mandatory parameters x-instagram-gis and update it after each call. With this parameter, paginate is working properly.

You can see an example here : https://github.com/pgrimaud/instagram-user-feed/blob/master/examples/medias.php

Hope it helps

facreationz commented 6 years ago

@pgrimaud Apologies Ive been busy elsewhere. Yes it works brilliantly. Thanks a lot. Good job.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.