HydrogenAudio

Hydrogenaudio Forum => Uploads => Topic started by: romor on 2011-10-28 08:52:56

Title: Playlist generator from online streams
Post by: romor on 2011-10-28 08:52:56
I wrote another playlist generator. This time streams are generated by search query from SoundCloud or YouTube.
It's written in Python and uses SPL, so any common Python should work, on any platform I guess

script (http://db.tt/UxdAiCNz)  download (http://db.tt/8praNIvx)

What it's supposed to do is provide access to those streams in preferred player instead browser, by providing playlists in various formats:

Usage:
Code: [Select]
python scrap.py <search term> [soundcloud] [PLS|ASX|POD|CAST|XSPF]

Code: [Select]
M3U  - Extended M3U (EXTM3U) playlist format (with title information)
PLS  - simple PLS format (with title information)
ASX  - ASX v3 (with title, links, artwork etc.)
POD  - XML podcast written to stdout (with title, links, artwork etc.)
CAST - XML podcast uploaded on server with return link for subscribing (with title, links, artwork etc.)
XSPF - XSPF format (with title, links, artwork etc.)

Arguments in square brackets are optional. It defaults to YouTube and M3U and all output is to stdout

Examples:
Code: [Select]
> python scrap.py "vainuo goths" cast
# will return URL for "subscribing" to created "podcast"
> python scrap.py dighom soundcloud > dighom.m3u && vlc dighom.m3u
#redirect output to m3u file, then open it with vlc


Both SoundCloud and YouTube parsers use regular APIs provided by services. Additionally YouTube is scraped for "hq" streams as their default gdata response does not reveal those (as expected) but only poor quality rtsp streams with 3GP files. I spent some time on improving this approach and as only/best possible solution - every item from YouTube query is parsed with partial request (24KB) to get those streams. On top of it, playlist is valid for 6h afterwhich streams wont work.

It's not throughout tested, but I want to think that script is compact and flexible. Couple of queries in all playlist formats are tested with foobar2000 and VLC successfully. Also got these for podcasts and XSPF:

(http://svn.xiph.org/websites/xspf.org/images/banners/valid-xspf.png)  (http://feedvalidator.org/images/valid-rss-rogers.png)
Title: Playlist generator from online streams
Post by: romor on 2011-10-31 02:12:44
Added Grooveshark option. Script from first post updated.
Every service is accessed through valid API calls despite script name

Usage:
Code: [Select]
python scrap.py <search term> [soundcloud|grooveshark|youtube] [PLS|ASX|POD|CAST|XSPF]

Title: Playlist generator from online streams
Post by: Emerelle on 2011-11-03 14:32:21
Okay, I apologize for my really stupid question in advance but I am too anxious to try this out *not* to ask.
Where does the search go? So...
1. Installing python and
2. searching from...?

Sorry, I havent used python scripts before (other than the python grabber from some plugin). Youtube search (besides all the other options you have added) would be so awesome!