postaddictme / instagram-php-scraper

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

getMedias with tree parameters #427

Closed neonpc closed 5 years ago

neonpc commented 5 years ago

When I try to get medias using the third parameter I get an error.

This is a real example: $instagram = new \InstagramScraper\Instagram(); $media_data = $instagram->getMedias('netflixes', 20, 1906812552835504063);

This is the error obtained:

( [code] => 400 [raw_body] => {"message": "execution failure", "errors": [{"message": "execution error", "locations": []}], "data": {"user": null}, "status": "fail"} [body] => stdClass Object ( [message] => execution failure [errors] => Array ( [0] => stdClass Object ( [message] => execution error [locations] => Array ( ) ) ) [data] => stdClass Object ( [user] => ) [status] => fail ) [headers] => Array ( [0] => HTTP/1.1 400 Bad Request [Content-Type] => application/json; charset=utf-8 [Cache-Control] => private, no-cache, no-store, must-revalidate [Pragma] => no-cache [Expires] => Sat, 01 Jan 2000 00:00:00 GMT [Vary] => Accept-Language, Cookie [Content-Language] => en [Date] => Thu, 29 Nov 2018 13:04:01 GMT [Strict-Transport-Security] => max-age=60 [X-Frame-Options] => SAMEORIGIN [content-security-policy] => report-uri https://www.instagram.com/security/csp_report/; default-src 'self' https://www.instagram.com; img-src https: data: blob:; font-src https: data:; media-src 'self' blob: https://www.instagram.com https://*.cdninstagram.com https://*.fbcdn.net; manifest-src 'self' https://www.instagram.com; script-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://*.cdninstagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' https://*.www.instagram.com https://www.instagram.com 'unsafe-inline'; connect-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://graph.instagram.com https://*.graph.instagram.com https://*.cdninstagram.com https://api.instagram.com wss://www.instagram.com wss://edge-chat.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; worker-src 'self' https://www.instagram.com; frame-src 'self' https://instagram.com https://www.instagram.com https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'; upgrade-insecure-requests [X-Content-Type-Options] => nosniff [X-XSS-Protection] => 0 [Set-Cookie] => csrftoken=GcC9lhikMeXFdzZ2uiPx56QE9zZZHsTy; Domain=.instagram.com; expires=Thu, 28-Nov-2019 13:04:01 GMT; Max-Age=31449600; Path=/; Secure [Connection] => keep-alive [Content-Length] => 135 ) )

mnajafzadeh commented 5 years ago

Hi,

I have the same problem! Any solution?

mnajafzadeh commented 5 years ago

Hi,

I have the same problem! Any solution?

I found the solution! The maxId here is not referring to the max item ID. It is the max pagination ID. You need to use getPaginateMedias() method if you want to paginate in items. Look at this example https://github.com/postaddictme/instagram-php-scraper/blob/master/examples/paginateAccountMediaByUsername.php

neonpc commented 5 years ago

Hi, I have the same problem! Any solution?

I found the solution! The maxId here is not referring to the max item ID. It is the max pagination ID. You need to use getPaginateMedias() method if you want to paginate in items. Look at this example https://github.com/postaddictme/instagram-php-scraper/blob/master/examples/paginateAccountMediaByUsername.php

Hi, thanks for the info. I'll try if I can the next week.

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.