From 44e60c3e2193d3198899f211a8b7c9767b0b6d5e Mon Sep 17 00:00:00 2001 From: Valdemar Erk Date: Sat, 10 Dec 2016 12:23:35 +0100 Subject: [PATCH] Initial support for yizhibo.com --- src/you_get/common.py | 1 + src/you_get/extractors/yizhibo.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/you_get/extractors/yizhibo.py diff --git a/src/you_get/common.py b/src/you_get/common.py index 7db4fba2..fd727cf4 100755 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -91,6 +91,7 @@ SITES = { 'xiaojiadianvideo' : 'fc2video', 'yinyuetai' : 'yinyuetai', 'miaopai' : 'yixia', + 'yizhibo' : 'yizhibo', 'youku' : 'youku', 'youtu' : 'youtube', 'youtube' : 'youtube', diff --git a/src/you_get/extractors/yizhibo.py b/src/you_get/extractors/yizhibo.py new file mode 100644 index 00000000..f524a0a8 --- /dev/null +++ b/src/you_get/extractors/yizhibo.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +__all__ = ['yizhibo_download'] + +from ..common import * +import json +import time + +def yizhibo_download(url, output_dir = '.', merge = True, info_only = False, **kwargs): + video_id = url[url.rfind('/')+1:].split(".")[0] + json_request_url = 'http://www.yizhibo.com/live/h5api/get_basic_live_info?scid={}'.format(video_id) + content = get_html(json_request_url) + error = json.loads(content)['result'] + if (error != 1): + raise ValueError("Error : {}".format(error)) + + data = json.loads(content)#['data'] + title = data.get('data')['live_title'] + if (title == ''): + title = data.get('data')['nickname'] + real_url = data.get('data')['play_url'] + + print_info(site_info, title, 'flv', float('inf')) + if not info_only: + download_url_ffmpeg(real_url, title, 'flv', None, output_dir, merge = merge) + +site_info = "yizhibo.com" +download = yizhibo_download +download_playlist = playlist_not_supported('yizhibo')