2014-10-10 18:48:00 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
__all__ = ['douyutv_download']
|
|
|
|
|
|
|
|
from ..common import *
|
|
|
|
import json
|
|
|
|
|
|
|
|
def douyutv_download(url, output_dir = '.', merge = True, info_only = False):
|
2014-11-18 10:57:04 +03:00
|
|
|
room_id = url[url.rfind('/')+1:]
|
|
|
|
|
|
|
|
content = get_html("http://www.douyutv.com/api/client/room/"+room_id)
|
|
|
|
data = json.loads(content)['data']
|
|
|
|
|
|
|
|
title = data.get('room_name')
|
|
|
|
real_url = data.get('rtmp_url')+'/'+data.get('rtmp_live')
|
|
|
|
|
2014-10-25 15:46:25 +04:00
|
|
|
print_info(site_info, title, 'flv', float('inf'))
|
2014-10-10 18:48:00 +04:00
|
|
|
if not info_only:
|
2014-10-25 15:46:25 +04:00
|
|
|
download_urls([real_url], title, 'flv', None, output_dir, merge = merge)
|
2014-10-10 18:48:00 +04:00
|
|
|
|
|
|
|
site_info = "douyutv.com"
|
|
|
|
download = douyutv_download
|
|
|
|
download_playlist = playlist_not_supported('douyutv')
|