Repository: postaddictme/instagram-php-scraper (language: php)

Issue:
error when trying to fetch data use getMediaByUrl()
hi contributor and my friends.
i have one problem when call this method and then i got response
`Message: Media with this code does not exist` but the media url is also exist.


Discussion / hints:
Same thing happens for me. Proof of concept:

```
<?php
use InstagramScraper\Instagram;
use GuzzleHttp\Client;

$instagram = Instagram::withCredentials( new Client(), '', '', null );
$instagram->loginWithSessionId( '<your-user-session-id-goes-here>' );

$media = $instagram->getMediaByUrl( 'https://www.instagram.com/p/BsOGulcndj-/' );
var_dump( $media );
```

Response from request to Instagram:

```
for (;;);{"__ar":1,"error":1357004,"errorSummary":"Sorry, something went wrong","errorDescription":"Please try closing and re-opening your browser window.","payload":null,"hsrp":{"hblp":{"consistency":{"rev":1005858897}}},"lid":"7121366591489386466"}'
```

Maybe related to #1067?

Fix patch:
diff --git a/src/InstagramScraper/Endpoints.php b/src/InstagramScraper/Endpoints.php
index a0c63d3a..4b2cfb54 100644
--- a/src/InstagramScraper/Endpoints.php
+++ b/src/InstagramScraper/Endpoints.php
@@ -12,7 +12,7 @@ class Endpoints
     const ACCOUNT_TAGGED_MEDIAS = 'https://www.instagram.com/graphql/query/?query_hash=be13233562af2d229b008d2976b998b5&variables={variables}';
     const ACCOUNT_JSON_INFO = 'https://www.instagram.com/{username}/?__a=1&__d=dis';
     const ACCOUNT_ACTIVITY = 'https://www.instagram.com/accounts/activity/?__a=1';
-    const MEDIA_JSON_INFO = 'https://www.instagram.com/p/{code}/?__a=1';
+    const MEDIA_JSON_INFO = 'https://www.instagram.com/p/{code}/?__a=1&__d=dis';
     const MEDIA_JSON_BY_LOCATION_ID = 'https://www.instagram.com/explore/locations/{{facebookLocationId}}/?__a=1&max_id={{maxId}}';
     const MEDIA_JSON_BY_TAG = 'https://www.instagram.com/explore/tags/{tag}/?__a=1&max_id={max_id}';
     const GENERAL_SEARCH = 'https://www.instagram.com/web/search/topsearch/?query={query}&count={count}';
diff --git a/src/InstagramScraper/Instagram.php b/src/InstagramScraper/Instagram.php
index 0a39db75..9f7e1f4d 100644
--- a/src/InstagramScraper/Instagram.php
+++ b/src/InstagramScraper/Instagram.php
@@ -977,7 +977,7 @@ public function getMediaByUrl($mediaUrl)
         if (filter_var($mediaUrl, FILTER_VALIDATE_URL) === false) {
             throw new InvalidArgumentException('Malformed media url');
         }
-        $response = Request::get(rtrim($mediaUrl, '/') . '/?__a=1', $this->generateHeaders($this->userSession));
+        $response = Request::get(rtrim($mediaUrl, '/') . '/?__a=1&__d=dis', $this->generateHeaders($this->userSession));
 
         if (static::HTTP_NOT_FOUND === $response->code) {
             throw new InstagramNotFoundException('Media with given code does not exist or account is private.');


Test patch: