Skip to content

Instantly share code, notes, and snippets.

@yanyaoer
Created April 20, 2011 10:23
Show Gist options
  • Save yanyaoer/930933 to your computer and use it in GitHub Desktop.
Save yanyaoer/930933 to your computer and use it in GitHub Desktop.
listening my douban.fm with python & mpg123
# vim: set et sw=4 ts=4 sts=4 fdm=syntax ff=unix fenc=utf8:
#!/usr/bin/python
import json
from subprocess import Popen
import urllib2
_url = 'http://douban.fm/j/mine/playlist?type=n&h=&channel=0'
req = urllib2.urlopen(urllib2.Request(_url))
obj = json.load(req)
playlist = ''
for s in obj['song']:
playlist = playlist+" "+s['url']
Popen('mpg123 '+playlist, shell=True)
@tigerwang202
Copy link

it can NOT work currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment