Skip to content

Instantly share code, notes, and snippets.

@Justsoos
Last active February 13, 2019 17:06
Show Gist options
  • Save Justsoos/b15aece4dc80c5b2c680e0f5df264d48 to your computer and use it in GitHub Desktop.
Save Justsoos/b15aece4dc80c5b2c680e0f5df264d48 to your computer and use it in GitHub Desktop.
USAGE: python douyu_curl.py "copy as curl" >>> GET THE URL 已作废
#! /usr/bin/env python3
import sys
import json
import re
import subprocess
t = sys.argv
t = [i.replace('^','') for i in t] #for chrome bad escape character
t = [re.sub(r'rate=([0-9])','0',i) for i in t] #only show original resolution
del t[0]
t[0]= ['curl -s']
api_r = subprocess.check_output(t,universal_newlines=True)
s = json.loads(api_r)['data']
rtmp_url = s['rtmp_url']
rtmp_live = s['rtmp_live']
e = rtmp_url + '/' + rtmp_live
print(e)
@Justsoos
Copy link
Author

Justsoos commented Jul 20, 2017

具体参考这里:rosynirvana/douyu_cli#4 (comment)

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