Skip to content

Instantly share code, notes, and snippets.

@jaseg
Created July 12, 2014 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaseg/cce6a9d250c2d9a120bc to your computer and use it in GitHub Desktop.
Save jaseg/cce6a9d250c2d9a120bc to your computer and use it in GitHub Desktop.
Play music links on a subreddit using ipython
In [1]: %rehashx
In [2]: import praw
In [3]: urls = [e.url.replace('https', 'http') for e in praw.Reddit('ipython').get_subreddit('indie_rock').get_hot(limit=30) if 'youtu' in e.url or 'soundcloud' in e.url]
In [4]: for url in urls:
!mpv --no-video "$url"
....:
Playing: http://www.youtube.com/watch?v=sXfLPNv-Axs
[quvi] Checking URL...
[stream] Video --vid=1 (vp8)
[stream] Audio (+) --aid=1 (*) (vorbis)
Video: no video
AO: [pulse] 44100Hz stereo 2ch float
A: 00:00:00 / 00:06:53 (0%) Cache: 2%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment