Closed ximrx closed 7 years ago
@ximrx it works. $media = Instagram::getMediaByCode('BQ6W8k6goDE'); $media->imageHighResolutionUrl
there is no 'url' index in the array
Fatal error: Uncaught exception 'InstagramScraper\Exception\InstagramException' with message 'Media with this code does not exist' in
/php/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php:179 Stack trace: #0
/php/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php(162): InstagramScraper\Instagram::getMediaByUrl('https://www.ins...') #1
/htdocs/post.php(106): InstagramScraper\Instagram::getMediaByCode('BQ6W8k6goDE') #2 {main} thrown in
php/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 179
I'm also seeing this.
There were 2 errors:
1) InstagramTest::testGetMediaByCode
InstagramScraper\Exception\InstagramException: Media with this code does not exist
/Users/jason/Sites/instagram-php-scraper/src/InstagramScraper/Instagram.php:117
/Users/jason/Sites/instagram-php-scraper/src/InstagramScraper/Instagram.php:100
/Users/jason/Sites/instagram-php-scraper/tests/InstagramTest.php:56
2) InstagramTest::testGetMediaByUrl
InstagramScraper\Exception\InstagramException: Media with this code does not exist
/Users/jason/Sites/instagram-php-scraper/src/InstagramScraper/Instagram.php:117
/Users/jason/Sites/instagram-php-scraper/tests/InstagramTest.php:62
--
There was 1 failure:
1) InstagramTest::testGeMediaCommentsByCode
Failed asserting that 37 matches expected 38.
/Users/jason/Sites/instagram-php-scraper/tests/InstagramTest.php:110
ERRORS!
Tests: 13, Assertions: 14, Errors: 2, Failures: 1.
It appears the data structure has changed, i.e. there's no longer a media
index in the response:
array (
'graphql' =>
array (
'shortcode_media' =>
array (
'__typename' => 'GraphImage',
'id' => '1286417446659853191',
'shortcode' => 'BHaRdodBouH',
'dimensions' =>
array (
'height' => 1081,
'width' => 1080,
),
'display_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-15/e35/13561512_1231835960184186_1767799031_n.jpg',
'is_video' => false,
'edge_media_to_tagged_user' =>
array (
'edges' =>
array (
),
),
'edge_media_to_caption' =>
array (
'edges' =>
array (
0 =>
array (
'node' =>
array (
'text' => '@dolly loves Lake Tahoe 🇺🇸🇺🇸🇺🇸',
),
),
),
),
'caption_is_edited' => false,
'edge_media_to_comment' =>
array (
'count' => 467,
'page_info' =>
array (
'has_next_page' => true,
'end_cursor' => 'AQCRTQsvR0RrzoHzaflUGzjflGKX8Pq9U79qz_p9MWCgCGgP7h59AvOthYG2jIY02Jf7ozj7P11egJ_GEoqhCG_JKTjvLnZBg4waowTpjlfKTA',
),
'edges' =>
array (
0 =>
array (
'node' =>
array (
'id' => '17862163918026584',
'text' => 'Parece o meu!!! #zeus @zeusberro :D',
'created_at' => 1473706454,
'owner' =>
array (
'id' => '12952022',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/13355546_1218348768199800_1963992773_a.jpg',
'username' => 'regisberro',
),
),
),
1 =>
array (
'node' =>
array (
'id' => '17862191362026584',
'text' => '@gracie.nz ta',
'created_at' => 1473749700,
'owner' =>
array (
'id' => '1575582265',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17881378_416418062070630_9078777697932410880_a.jpg',
'username' => '_taeheekim',
),
),
),
2 =>
array (
'node' =>
array (
'id' => '17862194149026584',
'text' => 'AWWWWWW @taeheexkim',
'created_at' => 1473755220,
'owner' =>
array (
'id' => '1260838479',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/15876441_1525096334185629_216522512710762496_n.jpg',
'username' => 'gracie.nz',
),
),
),
3 =>
array (
'node' =>
array (
'id' => '17862194350026584',
'text' => '@gracie.nz haha not about that ta ...',
'created_at' => 1473755784,
'owner' =>
array (
'id' => '1575582265',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17881378_416418062070630_9078777697932410880_a.jpg',
'username' => '_taeheekim',
),
),
),
4 =>
array (
'node' =>
array (
'id' => '17862245689026584',
'text' => 'Mas bonito es MAX',
'created_at' => 1473850890,
'owner' =>
array (
'id' => '21823343',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/12599161_449754491889708_1328693787_a.jpg',
'username' => 'beamena',
),
),
),
5 =>
array (
'node' =>
array (
'id' => '17862281152026584',
'text' => '💟ðŸ˜',
'created_at' => 1473925440,
'owner' =>
array (
'id' => '3230479012',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17881862_1874049492818150_1387382128617979904_a.jpg',
'username' => 'la.belle.mia',
),
),
),
6 =>
array (
'node' =>
array (
'id' => '17862487264026584',
'text' => 'There\'s a page where it shows dead dogs and you\'re not doing anything about it.',
'created_at' => 1474310356,
'owner' =>
array (
'id' => '3592368964',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17932613_395139544202585_8104640967300087808_a.jpg',
'username' => 'jxxshh',
),
),
),
7 =>
array (
'node' =>
array (
'id' => '17862498613026584',
'text' => 'It\'s Kevin @owenisdead',
'created_at' => 1474334795,
'owner' =>
array (
'id' => '432004328',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/15101578_1623252787968260_8272437037383024640_a.jpg',
'username' => 'project_nam',
),
),
),
8 =>
array (
'node' =>
array (
'id' => '17862526978026584',
'text' => '@kevin I can remember when you first got dolly she\'s all grown up now she\'s so adorable and gorgeous woof woof ðŸ†',
'created_at' => 1474392826,
'owner' =>
array (
'id' => '2074776736',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17881207_1372200689504833_8073303717677367296_a.jpg',
'username' => 'cometboo8',
),
),
),
9 =>
array (
'node' =>
array (
'id' => '17862851740026584',
'text' => 'How lovely 😠@kevin',
'created_at' => 1475074837,
'owner' =>
array (
'id' => '459657175',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/13696376_1080340875381603_1773538195_a.jpg',
'username' => 'elisabetta.bonomi',
),
),
),
10 =>
array (
'node' =>
array (
'id' => '17862856531026584',
'text' => 'B-)',
'created_at' => 1475085108,
'owner' =>
array (
'id' => '3945320500',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17819306_1960740617480276_4483098232343232512_a.jpg',
'username' => 'joseep_20',
),
),
),
11 =>
array (
'node' =>
array (
'id' => '17862860059026584',
'text' => 'Dogs are magical creatures 😌 it\'s such a trip when you consider that they are experiencing their own reality separate from yours, with their own abstract thoughts and emotions, they have their own "life", and seem completely in the moment.',
'created_at' => 1475092075,
'owner' =>
array (
'id' => '1767691865',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/16230704_611432172376697_1903909077616951296_a.jpg',
'username' => 'danieldustart',
),
),
),
12 =>
array (
'node' =>
array (
'id' => '17863113346026584',
'text' => '@danieldustart love dogs',
'created_at' => 1475445848,
'owner' =>
array (
'id' => '3945320500',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17819306_1960740617480276_4483098232343232512_a.jpg',
'username' => 'joseep_20',
),
),
),
13 =>
array (
'node' =>
array (
'id' => '17863362904026584',
'text' => 'Hello there beautiful â¤',
'created_at' => 1475821900,
'owner' =>
array (
'id' => '1427492495',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/10617155_540903479394269_1217178624_a.jpg',
'username' => 'sillysausagepublications',
),
),
),
14 =>
array (
'node' =>
array (
'id' => '17863564558026584',
'text' => 'lovely puppy',
'created_at' => 1476129447,
'owner' =>
array (
'id' => '1421143996',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17881341_1324353187657586_3464892272510763008_a.jpg',
'username' => 'iamynah67',
),
),
),
15 =>
array (
'node' =>
array (
'id' => '17863711129026584',
'text' => 'Beautiful dog xx',
'created_at' => 1476396390,
'owner' =>
array (
'id' => '4786194',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/14276431_1743968085853555_1611663000_a.jpg',
'username' => 'serenacrawford',
),
),
),
16 =>
array (
'node' =>
array (
'id' => '17863772848026584',
'text' => '@egs222',
'created_at' => 1476494879,
'owner' =>
array (
'id' => '1623346918',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17881222_1739203489439793_3091928337707171840_a.jpg',
'username' => 'eugenia_settle',
),
),
),
17 =>
array (
'node' =>
array (
'id' => '17864444227058558',
'text' => 'So cute😀😀😀',
'created_at' => 1477627536,
'owner' =>
array (
'id' => '3100634995',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/12677403_254669001545992_1120278984_a.jpg',
'username' => 'hautedecorinterior',
),
),
),
18 =>
array (
'node' =>
array (
'id' => '17854796947111130',
'text' => 'very sweetðŸ˜ðŸ’™ðŸ’™ðŸ’™',
'created_at' => 1478014865,
'owner' =>
array (
'id' => '1683432255',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/10844237_196418790746338_736774409_a.jpg',
'username' => 'my_name_is_bobba',
),
),
),
19 =>
array (
'node' =>
array (
'id' => '17858733493069025',
'text' => 'HAPPY DOG!',
'created_at' => 1478200822,
'owner' =>
array (
'id' => '1779005277',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17662389_1290805881001488_8432885251646160896_a.jpg',
'username' => 'healthyfitfran',
),
),
),
20 =>
array (
'node' =>
array (
'id' => '17854775992129844',
'text' => 'Ahhhhh @georgiacoggings_',
'created_at' => 1478676181,
'owner' =>
array (
'id' => '239667802',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17818558_210034722818606_7022355349541748736_a.jpg',
'username' => 'eeemilywalker',
),
),
),
21 =>
array (
'node' =>
array (
'id' => '17845717174131154',
'text' => 'ðŸ˜ðŸ‘ŒðŸ’›ðŸ¶',
'created_at' => 1479843469,
'owner' =>
array (
'id' => '2019933350',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/11910372_714247368709874_1473971256_a.jpg',
'username' => 'janlundell',
),
),
),
22 =>
array (
'node' =>
array (
'id' => '17865729034051812',
'text' => 'ðŸ˜ðŸ˜ðŸ˜ðŸ‘ðŸ‘ðŸ‘',
'created_at' => 1479951256,
'owner' =>
array (
'id' => '1822061526',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/11208598_440659872771640_900555663_a.jpg',
'username' => 'pupilla_firenze',
),
),
),
23 =>
array (
'node' =>
array (
'id' => '17845124416189964',
'text' => '@mp_cummings soooo cute',
'created_at' => 1481052168,
'owner' =>
array (
'id' => '13483540',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/16122995_1893113807591522_5137324538681360384_n.jpg',
'username' => 'b_giddens',
),
),
),
24 =>
array (
'node' =>
array (
'id' => '17858134795103265',
'text' => 'I\'m loving Dolly 😃💗ðŸ•ðŸ¾',
'created_at' => 1483378633,
'owner' =>
array (
'id' => '1566160382',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/923834_685857228195515_175204822_a.jpg',
'username' => 'trainingwithtammy',
),
),
),
25 =>
array (
'node' =>
array (
'id' => '17856854878082556',
'text' => ':)',
'created_at' => 1483661540,
'owner' =>
array (
'id' => '3978554689',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/14478464_667325100094106_6937025318716702720_a.jpg',
'username' => 'rfarmer4400',
),
),
),
26 =>
array (
'node' =>
array (
'id' => '17846738911148469',
'text' => 'Dear @kevin please take a look at my drawing, I dedicated to you 🌹☕',
'created_at' => 1483733953,
'owner' =>
array (
'id' => '4043907111',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/16229299_247602312356864_6190975669606809600_a.jpg',
'username' => 'tariqlifeisart',
),
),
),
27 =>
array (
'node' =>
array (
'id' => '17847748135151806',
'text' => 'I love dogs',
'created_at' => 1485071641,
'owner' =>
array (
'id' => '3943389208',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/18011808_409168656106036_180852349755981824_a.jpg',
'username' => '_fw.dime_',
),
),
),
28 =>
array (
'node' =>
array (
'id' => '17859809530093416',
'text' => '@svea_mr',
'created_at' => 1487184579,
'owner' =>
array (
'id' => '2374572472',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/16583499_1943971059167653_1275861099459117056_a.jpg',
'username' => 'aennebella',
),
),
),
29 =>
array (
'node' =>
array (
'id' => '17863786936079392',
'text' => 'Hi.🤗â¤ðŸ˜™',
'created_at' => 1487452435,
'owner' =>
array (
'id' => '3946483470',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/14287937_1770582643157131_133024434_a.jpg',
'username' => 'romerobiene',
),
),
),
30 =>
array (
'node' =>
array (
'id' => '17850162061149700',
'text' => 'The ability to smile with an open heart â¤ï¸',
'created_at' => 1487452765,
'owner' =>
array (
'id' => '2204666637',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17126883_623373351197187_3299276757324005376_a.jpg',
'username' => 'marco_briano_',
),
),
),
31 =>
array (
'node' =>
array (
'id' => '17874229459003159',
'text' => 'ðŸ˜ðŸ¤—',
'created_at' => 1488760019,
'owner' =>
array (
'id' => '2218325077',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/16788737_1842470696012595_2453509469523410944_a.jpg',
'username' => 'monicamouradesigner',
),
),
),
32 =>
array (
'node' =>
array (
'id' => '17877362641030622',
'text' => '😘ðŸ¶',
'created_at' => 1488789974,
'owner' =>
array (
'id' => '20418645',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/16789164_1808953092762409_2955117574741819392_a.jpg',
'username' => 'jerrylopezny',
),
),
),
33 =>
array (
'node' =>
array (
'id' => '17854442383133419',
'text' => 'â¤â¤â¤â¤',
'created_at' => 1490345788,
'owner' =>
array (
'id' => '3269219042',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17333160_1868320520113024_205017330411896832_a.jpg',
'username' => 'chicbraid',
),
),
),
34 =>
array (
'node' =>
array (
'id' => '17878085638002181',
'text' => 'Perfect',
'created_at' => 1492422965,
'owner' =>
array (
'id' => '2336128573',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/16584814_1234817186615223_8470278478170685440_a.jpg',
'username' => 'web_whale',
),
),
),
),
),
'comments_disabled' => false,
'taken_at_timestamp' => 1467572931,
'edge_media_preview_like' =>
array (
'count' => 12181,
'edges' =>
array (
0 =>
array (
'node' =>
array (
'id' => '2123848937',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17333878_428262200859565_4483838804964147200_a.jpg',
'username' => 'ferdianarevaa',
),
),
1 =>
array (
'node' =>
array (
'id' => '3191124050',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17663224_1893564074248363_656957712264855552_n.jpg',
'username' => 'omariogasparini',
),
),
2 =>
array (
'node' =>
array (
'id' => '2724301635',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/18012071_1313782615372157_7454337606780715008_a.jpg',
'username' => 'themimzyofficial',
),
),
3 =>
array (
'node' =>
array (
'id' => '3469245926',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17125605_664705433738066_5776369608801910784_a.jpg',
'username' => 'meline_glbr',
),
),
4 =>
array (
'node' =>
array (
'id' => '2204666637',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17126883_623373351197187_3299276757324005376_a.jpg',
'username' => 'marco_briano_',
),
),
5 =>
array (
'node' =>
array (
'id' => '3946483470',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/14287937_1770582643157131_133024434_a.jpg',
'username' => 'romerobiene',
),
),
6 =>
array (
'node' =>
array (
'id' => '630881694',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/10731968_678361582277979_165447659_a.jpg',
'username' => 'larouze',
),
),
7 =>
array (
'node' =>
array (
'id' => '1735034423',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/16585607_1385399024850855_8286447353846562816_a.jpg',
'username' => 'duaneawuahdarko',
),
),
8 =>
array (
'node' =>
array (
'id' => '1509349854',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/17267913_212060172606172_181654044056485888_a.jpg',
'username' => 'selenatorforever220792',
),
),
),
),
'edge_media_to_sponsor_user' =>
array (
'edges' =>
array (
),
),
'location' => NULL,
'viewer_has_liked' => false,
'owner' =>
array (
'id' => '3',
'profile_pic_url' => 'https://instagram.fcmh1-1.fna.fbcdn.net/t51.2885-19/s150x150/13732144_1764457777134045_549538515_a.jpg',
'username' => 'kevin',
'followed_by_viewer' => false,
'full_name' => 'Kevin Systrom',
'is_private' => false,
'requested_by_viewer' => false,
'is_unpublished' => false,
'blocked_by_viewer' => false,
'has_blocked_viewer' => false,
),
'is_ad' => false,
'edge_web_media_to_related_media' =>
array (
'edges' =>
array (
),
),
),
),
)
True. Thank you
They have added in response all medias from carousel and changed response structure.
Fixed
require_once './php/vendor/autoload.php'; Unirest\Request::verifyPeer(false); use InstagramScraper\Instagram; $media = Instagram::getMediaByCode('BQ6W8k6goDE'); $media->imageHighResolutionUrl;