add support for Joy.cn, fix #86

This commit is contained in:
Mort Yao 2013-01-27 16:54:11 +01:00
parent 967457dc51
commit 11cf8e4b73
5 changed files with 50 additions and 0 deletions

View File

@ -25,6 +25,7 @@ Fork me on GitHub: <https://github.com/soimort/you-get>
* CNTV (中国网络电视台) <http://www.cntv.cn>
* ifeng (凤凰视频) <http://v.ifeng.com>
* iQIYI (爱奇艺) <http://www.iqiyi.com>
* Joy.cn (激动网) <http://www.joy.cn>
* Ku6 (酷6网) <http://www.ku6.com>
* NetEase (网易视频) <http://v.163.com>
* PPTV <http://www.pptv.com>
@ -218,6 +219,7 @@ You-Get基于优酷下载脚本[iambus/youku-lixian](https://github.com/iambus/y
* CNTV <http://www.cntv.cn>
* 凤凰视频 <http://v.ifeng.com>
* 爱奇艺 <http://www.iqiyi.com>
* 激动网 <http://www.joy.cn>
* 酷6网 <http://www.ku6.com>
* 网易视频 <http://v.163.com>
* PPTV <http://www.pptv.com>

View File

@ -28,6 +28,7 @@ Supported Sites (As of Now)
* CNTV (中国网络电视台) http://www.cntv.cn
* ifeng (凤凰视频) http://v.ifeng.com
* iQIYI (爱奇艺) http://www.iqiyi.com
* Joy.cn (激动网) http://www.joy.cn
* Ku6 (酷6网) http://www.ku6.com
* NetEase (网易视频) http://v.163.com
* PPTV http://www.pptv.com

View File

@ -8,6 +8,7 @@ from .facebook import *
from .googleplus import *
from .ifeng import *
from .iqiyi import *
from .joy import *
from .ku6 import *
from .netease import *
from .pptv import *

45
you_get/downloader/joy.py Normal file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env python
__all__ = ['joy_download']
from ..common import *
def video_info(channel_id, program_id, volumn_id):
url = 'http://msx.app.joy.cn/service.php'
if program_id:
url += '?action=vodmsxv6'
url += '&channelid=%s' % channel_id
url += '&programid=%s' % program_id
url += '&volumnid=%s' % volumn_id
else:
url += '?action=msxv6'
url += '&videoid=%s' % volumn_id
xml = get_html(url)
name = r1(r'<Title>(?:<!\[CDATA\[)?(.+?)(?:\]\]>)?</Title>', xml)
urls = re.findall(r'<Url[^>]*>(?:<!\[CDATA\[)?(.*?)(?:\]\]>)?</Url>', xml)
hostpath = r1(r'<HostPath[^>]*>(?:<!\[CDATA\[)?(.+?)(?:\]\]>)?</HostPath>', xml)
return name, urls, hostpath
def joy_download(url, output_dir = '.', merge = True, info_only = False):
channel_id = r1(r'[^_]channelId\s*:\s*"([^\"]+)"', get_html(url))
program_id = r1(r'[^_]programId\s*:\s*"([^\"]+)"', get_html(url))
volumn_id = r1(r'[^_]videoId\s*:\s*"([^\"]+)"', get_html(url))
title, urls, hostpath = video_info(channel_id, program_id, volumn_id)
urls = [hostpath + url for url in urls]
size = 0
for url in urls:
_, ext, temp = url_info(url)
size += temp
print_info(site_info, title, ext, size)
if not info_only:
download_urls(urls, title, ext, size, output_dir = output_dir, merge = merge)
site_info = "Joy.cn"
download = joy_download
download_playlist = playlist_not_supported('joy')

View File

@ -29,6 +29,7 @@ def url_to_module(url):
'iask': sina,
'ifeng': ifeng,
'iqiyi': iqiyi,
'joy': joy,
'kankanews': bilibili,
'ku6': ku6,
'pptv': pptv,