mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2025-01-08 14:17:54 +01:00
cleaned up code to increase readability, fixed test 2
This commit is contained in:
parent
adb6f53432
commit
159a2cff27
@ -14,12 +14,6 @@ class ChangbaIE(InfoExtractor):
|
|||||||
'id': '1152860688',
|
'id': '1152860688',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': '对你爱不完【炫酷慢摇】 ',
|
'title': '对你爱不完【炫酷慢摇】 ',
|
||||||
# 'thumbnail': r're:^https?://.*\.jpg$',
|
|
||||||
# TODO more properties, either as:
|
|
||||||
# * A value
|
|
||||||
# * MD5 checksum; start the string with md5:
|
|
||||||
# * A regular expression; start the string with re:
|
|
||||||
# * Any Python type (for example int or float)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -33,7 +27,7 @@ class ChangbaIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'url': 'http://changba.com/s/CPiNWbAa1qy0po0llqIJbg',
|
'url': 'http://changba.com/s/CPiNWbAa1qy0po0llqIJbg',
|
||||||
'md5': '',
|
'md5': '7adcc9afb85ace8ff854bdd0e8567f50',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '136918054',
|
'id': '136918054',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
@ -54,21 +48,18 @@ class ChangbaIE(InfoExtractor):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
id = self._search_regex(r'workid=([0-9]+)', webpage, 'id')
|
id = self._search_regex(r'workid=([0-9]+)', webpage, 'id')
|
||||||
isvideo = self._search_regex(r'&isvideo=([0-9])', webpage, 'isvideo')
|
|
||||||
title = self._search_regex(r'<div[^>]+class="title"[^>]*>([^<]+)', webpage, 'title')
|
title = self._search_regex(r'<div[^>]+class="title"[^>]*>([^<]+)', webpage, 'title')
|
||||||
|
isvideo = self._search_regex(r'&isvideo=([0-9])', webpage, 'isvideo')
|
||||||
|
ext = 'mp3' if int(isvideo) == 0 else 'mp4'
|
||||||
|
|
||||||
ext = "mp4"
|
|
||||||
if int(isvideo) == 0:
|
|
||||||
ext = "mp3"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url = self._search_regex(r'([a-z]+:\/\/[0-9a-z]+\.changba\.com\/[a-z]+\/[a-z]+\/[0-9]+\/[0-9]+\.mp[3-4])', webpage, 'url')
|
url = self._search_regex(r'([a-z]+:\/\/[0-9a-z]+\.changba\.com\/[a-z]+\/[a-z]+\/[0-9]+\/[0-9]+\.mp[3-4])', webpage, 'url')
|
||||||
except:
|
except:
|
||||||
url = "http://lzscuw.changba.com/" + str(id) + "." + ext
|
url = 'http://lzscuw.changba.com/{}.{}'.format(str(id), ext)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'url': url,
|
'url': url,
|
||||||
'id': id,
|
'id': id,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
'title': title
|
'title': title,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user