Open c99koder opened 5 years ago
I've fixed it locally by passing the $index from the carousel image loop through to download_media_url and added the following to get the correct URL from the edge_sidecar_to_children array node:
if ( !empty( $result->graphql->shortcode_media->edge_sidecar_to_children)) {
$tmp = download_url( $result->graphql->shortcode_media->edge_sidecar_to_children->edges[$index]->node->display_url );
} else if (
! empty( $result->graphql->shortcode_media->display_url )
…
There's probably a better way to fix it, just a quick hack I added to get it working for now
I confirm - trying your fix @c99koder but no success. Does it still work on your end? I've added the $index param as an optional param with default value 0
@ni-ka it's still working for me, I've uploaded my changes to a branch you can try here: https://github.com/c99koder/DsgnWrks-Instagram-Importer/commit/d2524396c378e0104cd35bf5898d15a9ff791226
Thanks @c99koder - works nicely! I had omitted an optional parameter before the index.
@jtsternberg would you be interested in a pull request with the changes @c99koder which fix carousel posts?
Yes, sounds good.
I've submitted a pull request
The hack you're using in download_media_url() will always use the URL of the first image in the carousel instead of using the correct item from the graphql array in the json response, so it just downloads the thumbnail / cover image multiple times instead of each image in the carousel