Grab latest Playlist web page

I notice that the playlist URLs all have a randomized number in their URL, which makes it difficult for a script to “guess” the URL for the most recent playlist.

Is there any trick or code or shortcut to finding the URL to the “most recent” playlist for a particular show?

I want to have my site automatically link to the last show aired. I’m currently considering using PHP to parse the Show’s Spinitron Page, to find the URL to the top-most playlist - which would be clunky to say the least!

My Show page:

Most recent playlist: https://spinitron.com/KCSB/pl/**13457019**/The-Better-Way-Gospel-Hour

2nd playlist: https://spinitron.com/KCSB/pl/**13408680**/The-Better-Way-Gospel-Hour

How do I link to the top-most (most recent) playlist?

We don’t have a per-show URLs that provide an alias to the show’s most recent playlist. It’s an interesting idea. Would it be acceptable if there were a per-show URL that redirects 302 to a playlist?

As for your work-around, if you are using PHP then why not use the API? It’s easier than parsing HTML.

curl "https://spinitron.com/api/playlists?show_id=171162&count=1" -H "Authorization: Bearer YOURAPIKEY"

I’m trying to avoid using the API, because as a DJ, our station would prefer not to hand out the API key to DJ’s. (I did originally intend to use the API, but ran into this issue). If it’s insurmountable, then I’ll see if they’ll allow an exception to get the API key.

Currently I’m using the IFrame methods you previously showed me, with the IFRAME loading the page with ?css=xyz.css, and using the CSS to hide (display:none) everything except what I want to show.

Can the Redirect 302 method maintain the HTTP>GET variables? (So I can still pass css=xyz.css, bodyclass=xyz etc.)?
If so, then that would work fine.

Here’s the page I’m constructing, if you want to see what I’m trying to do: http://betterwaygospel.com As you can see, currently the player is hard-coded to play a specific show (with the random number in the URL) - in 2 weeks that will not show an Ark Player any more.

Hi @tom , do you think the 530 redirect can also pass the HTTP GET arguments? If so, I’d love to use that instead of PHP parsing. Let me know if that’s something you envision implementing soon, or if I should go ahead and get cracking with PHP!

Thanks for your excellent support.

Actually, I think redirect isn’t a good idea and doesn’t making things much easier to implement. We should just respond to the requested URL.