mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 20:52:31 +03:00
add support for Dilidili's new domain name
This commit is contained in:
parent
858435d503
commit
b8a2d0b235
@ -15,16 +15,13 @@ def ckplayer_get_info_by_xml(ckinfo):
|
|||||||
"""str->dict
|
"""str->dict
|
||||||
Information for CKPlayer API content."""
|
Information for CKPlayer API content."""
|
||||||
e = ET.XML(ckinfo)
|
e = ET.XML(ckinfo)
|
||||||
|
logging.debug('video xml info:\n{}'.format(ckinfo))
|
||||||
|
|
||||||
video_dict = {'title': '',
|
video_dict = {'title': '',
|
||||||
#'duration': 0,
|
#'duration': 0,
|
||||||
'links': [],
|
'links': [],
|
||||||
'size': 0,
|
'size': 0,
|
||||||
'flashvars': '',}
|
'flashvars': '',}
|
||||||
if '_text' in dictify(e)['ckplayer']['info'][0]['title'][0]: #title
|
|
||||||
video_dict['title'] = dictify(e)['ckplayer']['info'][0]['title'][0]['_text'].strip()
|
|
||||||
|
|
||||||
#if dictify(e)['ckplayer']['info'][0]['title'][0]['_text'].strip(): #duration
|
|
||||||
#video_dict['title'] = dictify(e)['ckplayer']['info'][0]['title'][0]['_text'].strip()
|
|
||||||
|
|
||||||
if '_text' in dictify(e)['ckplayer']['video'][0]['size'][0]: #size exists for 1 piece
|
if '_text' in dictify(e)['ckplayer']['video'][0]['size'][0]: #size exists for 1 piece
|
||||||
video_dict['size'] = sum([int(i['size'][0]['_text']) for i in dictify(e)['ckplayer']['video']])
|
video_dict['size'] = sum([int(i['size'][0]['_text']) for i in dictify(e)['ckplayer']['video']])
|
||||||
@ -37,6 +34,7 @@ def ckplayer_get_info_by_xml(ckinfo):
|
|||||||
|
|
||||||
return video_dict
|
return video_dict
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
#helper
|
#helper
|
||||||
#https://stackoverflow.com/questions/2148119/how-to-convert-an-xml-string-to-a-dictionary-in-python
|
#https://stackoverflow.com/questions/2148119/how-to-convert-an-xml-string-to-a-dictionary-in-python
|
||||||
|
@ -16,12 +16,15 @@ headers = {
|
|||||||
'Referer': 'http://www.dilidili.com/',
|
'Referer': 'http://www.dilidili.com/',
|
||||||
'Connection': 'keep-alive',
|
'Connection': 'keep-alive',
|
||||||
'Save-Data': 'on',
|
'Save-Data': 'on',
|
||||||
|
'Save-Data': 'on',
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def dilidili_parser_data_to_stream_types(typ ,vid ,hd2 ,sign, tmsign, ulk):
|
def dilidili_parser_data_to_stream_types(typ ,vid ,hd2 ,sign, tmsign, ulk):
|
||||||
"""->list"""
|
"""->list"""
|
||||||
parse_url = 'http://player.005.tv/parse.php?xmlurl=null&type={typ}&vid={vid}&hd={hd2}&sign={sign}&tmsign={tmsign}&userlink={ulk}'.format(typ = typ, vid = vid, hd2 = hd2, sign = sign, tmsign = tmsign, ulk = ulk)
|
parse_url = 'http://player.005.tv/parse.php?' \
|
||||||
|
'xmlurl=null&type={typ}&vid={vid}&hd={hd2}&sign={sign}&tmsign={tmsign}&userlink={ulk}'\
|
||||||
|
.format(typ = typ, vid = vid, hd2 = hd2, sign = sign, tmsign = tmsign, ulk = ulk)
|
||||||
html = get_content(parse_url, headers=headers)
|
html = get_content(parse_url, headers=headers)
|
||||||
|
|
||||||
info = re.search(r'(\{[^{]+\})(\{[^{]+\})(\{[^{]+\})(\{[^{]+\})(\{[^{]+\})', html).groups()
|
info = re.search(r'(\{[^{]+\})(\{[^{]+\})(\{[^{]+\})(\{[^{]+\})(\{[^{]+\})', html).groups()
|
||||||
@ -35,7 +38,7 @@ def dilidili_parser_data_to_stream_types(typ ,vid ,hd2 ,sign, tmsign, ulk):
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def dilidili_download(url, output_dir = '.', merge = False, info_only = False, **kwargs):
|
def dilidili_download(url, output_dir = '.', merge = False, info_only = False, **kwargs):
|
||||||
if re.match(r'http://www.dilidili.com/watch\S+', url):
|
if re.match(r'http://www.dilidili.(com|wang|mobi|name)/watch\S+', url):
|
||||||
html = get_content(url)
|
html = get_content(url)
|
||||||
title = match1(html, r'<title>(.+)丨(.+)</title>') #title
|
title = match1(html, r'<title>(.+)丨(.+)</title>') #title
|
||||||
|
|
||||||
@ -60,7 +63,9 @@ def dilidili_download(url, output_dir = '.', merge = False, info_only = False, *
|
|||||||
#get best
|
#get best
|
||||||
best_id = max([i['id'] for i in stream_types])
|
best_id = max([i['id'] for i in stream_types])
|
||||||
|
|
||||||
parse_url = 'http://player.005.tv/parse.php?xmlurl=null&type={typ}&vid={vid}&hd={hd2}&sign={sign}&tmsign={tmsign}&userlink={ulk}'.format(typ = typ, vid = vid, hd2 = best_id, sign = sign, tmsign = tmsign, ulk = ulk)
|
parse_url = 'http://player.005.tv/parse.php?' \
|
||||||
|
'xmlurl=null&type={typ}&vid={vid}&hd={hd2}&sign={sign}&tmsign={tmsign}&userlink={ulk}'\
|
||||||
|
.format(typ = typ, vid = vid, hd2 = best_id, sign = sign, tmsign = tmsign, ulk = ulk)
|
||||||
|
|
||||||
ckplayer_download(parse_url, output_dir, merge, info_only, is_xml = True, title = title, headers = headers)
|
ckplayer_download(parse_url, output_dir, merge, info_only, is_xml = True, title = title, headers = headers)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user