add iwara support

This commit is contained in:
w48325832 2017-06-26 23:59:47 +08:00
parent ca7d03357e
commit 12a842dd88

View File

@ -1,10 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
__all__ = ['iwara_download'] __all__ = ['iwara_download']
from ..common import * from ..common import *
from ..common import print_more_compatible as print
from ..extractor import VideoExtractor
from ..util import log
from .. import json_output
headers = { headers = {
'DNT': '1', 'DNT': '1',
'Accept-Encoding': 'gzip, deflate, sdch, br', 'Accept-Encoding': 'gzip, deflate, sdch, br',
@ -13,28 +9,26 @@ headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Cache-Control': 'max-age=0', 'Cache-Control': 'max-age=0',
'Referer': 'http://www.dilidili.com/',
'Connection': 'keep-alive', 'Connection': 'keep-alive',
'Save-Data': 'on', 'Save-Data': 'on',
'Cookie':'has_js=1;show_adult=1',
} }
def iwara_download(url, output_dir='.', merge=True, info_only=False, **kwargs): def iwara_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
global headers global headers
video_hash=match1(url, r'http://ecchi.iwara.tv/videos/(\w+)') video_hash=match1(url, r'http://ecchi.iwara.tv/videos/(\w+)')
html = get_html(url) html = get_content(url,headers=headers)
title = r1(r'<title>(.*)</title>', html) title = r1(r'<title>(.*)</title>', html)
api_url='http://ecchi.iwara.tv/api/video/'+video_hash api_url='http://ecchi.iwara.tv/api/video/'+video_hash
content=get_html(api_url) content=get_content(api_url,headers=headers)
mime='video/mp4' data=json.loads(content)
size=0; type,ext,size=url_info(data[0]['uri'], headers=headers)
print_info(content,title,mime,size) down_urls=data[0]['uri']
print_info(down_urls,title+data[0]['resolution'],type,size)
print_info(site_info, title, mime, size) download_urls([down_urls], title, ext, size, output_dir, merge = merge,headers=headers)
if not info_only:
download_urls([source], title, ext, size, output_dir, merge=merge)
site_info = "iwara" site_info = "iwara"
download = iwara_download download = iwara_download
download_playlist = playlist_not_supported('archive') download_playlist = playlist_not_supported('iwara')