Dymantic / laravel-instagram-feed

150 stars 51 forks source link

Carousel_Album #34

Closed ascentcreative closed 3 years ago

ascentcreative commented 3 years ago

Hi,

Great package - saved me a load of headaches so far!

I just have a query about the carousel item types - is it possible to enable those in full? The docs state that the first item is used, and they seem to be returned as "image" types. However, I noticed the media fields constant includes the "Children" field. It would be great to be able to pull out the data from the feed.

I know I can send a request myself to get that data, but just wondering if there's a method for calling that already within the package to reduce the number of calls etc and take advantage of the package's existing caching.

Many thanks!

michaeljoyner commented 3 years ago

Hi @ascentcreative. The only reason the carousel items aren't included is because I have never had a need for them, and no one else has requested it, until now.

Unfortunately, as things stand, there is no way for anyone to get the children media for carousel albums with this package. However, I'm currently busy with the next major version, and I'd be happy to include this.

ascentcreative commented 3 years ago

Hi - thanks for the update. That's fair enough.

I'm embedding posts in new site, and the old platform the client was using supports it, so I'm looking to head off questions from them :)

Having dug into the MediaParser, a simple fix might be adding:

'children' => $media['children']['data'] ?? ''

to the array returned by parseAsCarousel - it would need finessing to honour the ignore_video flag though.

I must admit I'm new to GIT and have never done a PR, but I might have a look at something in more depth if that would be ok?

michaeljoyner commented 3 years ago

You are more than welcome to send a PR! I don't mind adding this to the current version as long as it doesn't cause any breaking changes. If you need any help feel free to ask, I'll do my best to assist.

My suggestion would be to add two keys to the array returned by MediaParser, 'is_carousel', and 'children', so that people can check if it is a carousel album and then irritate over the children.

ascentcreative commented 3 years ago

Thanks very much - think I've managed to get there on the PR side :)

I've added those keys to the array.

Cheers very much for the help on this - Hope all goes well on the new version.

michaeljoyner commented 3 years ago

This is now available in v2.5. Thanks @ascentcreative