Add Yixia-Miaopai support, replace #639

This commit is contained in:
cnbeining 2015-10-21 13:46:46 -04:00
parent 91d060e721
commit 611546adb2
4 changed files with 46 additions and 0 deletions

View File

@ -61,6 +61,7 @@ Fork me on GitHub: <https://github.com/soimort/you-get>
* LeTV (乐视网) <http://www.letv.com> * LeTV (乐视网) <http://www.letv.com>
* Lizhi.fm (荔枝FM) <http://www.lizhi.fm> * Lizhi.fm (荔枝FM) <http://www.lizhi.fm>
* Metacafe <http://www.metacafe.com> * Metacafe <http://www.metacafe.com>
* MiaoPai (秒拍视频) <http://www.miaopai.com>
* MioMio <http://www.miomio.tv> * MioMio <http://www.miomio.tv>
* MTV 81 <http://www.mtv81.com> * MTV 81 <http://www.mtv81.com>
* NetEase (网易视频) <http://v.163.com> * NetEase (网易视频) <http://v.163.com>

View File

@ -71,6 +71,7 @@ SITES = {
'vk' : 'vk', 'vk' : 'vk',
'xiami' : 'xiami', 'xiami' : 'xiami',
'yinyuetai' : 'yinyuetai', 'yinyuetai' : 'yinyuetai',
'miaopai': 'yixia_miaopai',
'youku' : 'youku', 'youku' : 'youku',
'youtu' : 'youtube', 'youtu' : 'youtube',
'youtube' : 'youtube', 'youtube' : 'youtube',

View File

@ -62,6 +62,7 @@ from .vk import *
from .w56 import * from .w56 import *
from .xiami import * from .xiami import *
from .yinyuetai import * from .yinyuetai import *
from .yixia_miaopai import *
from .youku import * from .youku import *
from .youtube import * from .youtube import *
from .ted import * from .ted import *

View File

@ -0,0 +1,43 @@
#!/usr/bin/env python
__all__ = ['yixia_miaopai_download']
from ..common import *
#----------------------------------------------------------------------
def yixia_miaopai_download_by_scid(scid, output_dir = '.', merge = True, info_only = False):
""""""
headers = {
'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Cache-Control': 'max-age=0',
}
html = get_content('http://m.miaopai.com/show/channel/' + scid, headers)
title = match1(html, r'<title>(\w+)')
video_url = match1(html, r'<div class="vid_img" data-url=\'(.+)\'')
type, ext, size = url_info(video_url)
print_info(site_info, title, type, size)
if not info_only:
download_urls([video_url], title, ext, size, output_dir, merge=merge)
#----------------------------------------------------------------------
def yixia_miaopai_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
"""wrapper"""
if re.match(r'http://www.miaopai.com/show/channel/\w+', url):
scid = match1(url, r'http://www.miaopai.com/show/channel/(\w+)')
elif re.match(r'http://www.miaopai.com/show/\w+', url):
scid = match1(url, r'http://www.miaopai.com/show/(\w+)')
elif re.match(r'http://m.miaopai.com/show/channel/\w+', url):
scid = match1(url, r'http://m.miaopai.com/show/channel/(\w+)')
else:
pass
yixia_miaopai_download_by_scid(scid, output_dir, merge, info_only)
site_info = "Yixia MiaoPai"
download = yixia_miaopai_download
download_playlist = playlist_not_supported('yixia_miaopai')