amugofjava / podcast_search

A simple library providing programmatic access to the iTunes search API for podcasts.
MIT License
41 stars 26 forks source link

Add episode image to search #3

Closed vnl closed 3 years ago

vnl commented 3 years ago

Love the ease of use on the library. Was hoping to get individual image URL if present added to the list too (or am I doing something wrong that I cannot pick it up?). I think I traced it down to :

episodes.add(Episode.of(
          item.guid,
          item.title,
          item.description,
          item.link,
          Utils.parseRFC2822Date(item.pubDate),
          item.author ?? item.itunes.author,
          item.itunes?.duration,
          item.enclosure?.url,
          item.itunes?.season,
          item.itunes?.episode));

image

Do let me know if this is possible, please. If you have any suggestions otherwise, I am keen to learn that too.

amugofjava commented 3 years ago

Hi @vnl. The library doesn't currently support episode images, but this is something I want to add. There are a couple of ways I am looking at doing this: fetching an episode image if the episode feed contains a tag for am image, and/or extracting the image from the MP3 file itself.

vnl commented 3 years ago

I assumed so. Thanks for keeping this as a ToDo. For now, I will try to extract the images from the feed. Possibly taking your anytime_podcast_player as inspiration.

Nielssg commented 3 years ago

This would be a great feature to have, I was wondering whether it would be possible to add this? I might take a look at it and implement it myself for my use case, though I can't promise anything.

amugofjava commented 3 years ago

If there are image tags at the <item> level this should be fairly simple to implement. The trickier one is where the image is embedded in the MP3. If you have any examples of podcasts that have episode images in the RSS feed, please let me know and I'll take a look. Cheers.

Nielssg commented 3 years ago

Yes that would be great, I have found some random examples:

Image embedded as enclosure: https://www.huffpost.com/section/front-page/feed?x=1 <enclosure length="0" type="image/jpeg" url="https://img.huffingtonpost.com/asset/60628576240000eb182601aa.jpeg?cache=i6n0yztonr&ops=224_126"/>

Image as itunes image: https://lincolnproject.libsyn.com/rss <itunes:image href="https://ssl-static.libsyn.com/p/assets/d/c/9/6/dc96a8711b08ecf5/LINCOLN_RGB.png" />

Image as media content item (even contains thumbnail): https://www.politico.com/rss/politicopicks.xml, also https://www.yahoo.com/news/rss, https://www.latimes.com/local/rss2.0.xml <media:content type="image/jpeg" url="https://static.politico.com/c6/2f/fe7552df4375a66441f9f97d713d/20210329-joe-biden-ap-773.jpg">