Reputation: 141
Can I get the list of episodes of my anchor account in JS. Anchor give us embed code which is iframe.
Can I get the episode name with any public API?
My requirement is to show the list of all episodes of specific person on anchor platform on my mobile app.
Upvotes: 5
Views: 5464
Reputation:
Podcasts are based on RSS feeds, so yes, you can get all the details of your podcast by loading and reading the RSS feed off any podcast.
The RSS URL of the Anchor podcasts is https://anchor.fm/s/PODCAST_ID/podcast/rss
where PODCAST_ID
is the ID of your podcast.
Upvotes: 4
Reputation: 41
Q: Can I get the episode name with any public API?
There is no Public API from Anchor I think... And I need also to create my own landing page for my Podcast on Anchor. Then I look up the source code in my anchor page and I saw the window.__STATE__
variable in the source code.
Hmmm... It is very nice to me! With the window.__STATE__
I can catch json
value after using my dirty PHP Code. Just implements some built-in method PHP have:
and additional method if you want to save json
code in your internal file using:
This is my dirty PHP code (but it's work nicely!)
<?php
$html = file_get_contents('https://anchor.fm/<your-podcast-page-name>');
$json = substr($html, strpos($html, 'window.__STATE__ = {') , strpos($html, '"isError":false}};') - (strpos($html, 'window.__STATE__ = {')-1));
$json = str_replace('window.__STATE__ = ', '', $json);
$json = str_replace('"isNewUser":false,"', '"isNewUser":false,"isError":false}}', $json);
file_put_contents('podcasts.json', $json);
Sorry for my bad English... Cheers!
Upvotes: 3