mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2025-01-08 14:17:54 +01:00
replaced int to string conversion with 'int_or_none', made more robust by checking multiple subdomains for src link
This commit is contained in:
parent
5de4ebf7b5
commit
51dedc9f73
@ -2,6 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import int_or_none
|
||||||
|
|
||||||
|
|
||||||
class ChangbaIE(InfoExtractor):
|
class ChangbaIE(InfoExtractor):
|
||||||
@ -44,14 +45,30 @@ 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')
|
||||||
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')
|
isvideo = self._search_regex(r'&isvideo=([0-9])', webpage, 'isvideo')
|
||||||
ext = 'mp3' if int(isvideo) == 0 else 'mp4'
|
ext = 'mp3' if int_or_none(isvideo) == 0 else 'mp4'
|
||||||
|
|
||||||
|
SITE_SUBDOMAINS = [
|
||||||
|
'lzscuw',
|
||||||
|
'upscuw',
|
||||||
|
'aliuwmp3',
|
||||||
|
'upuwmp3',
|
||||||
|
'qiniuuwmp3'
|
||||||
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
src_url = self._search_regex(r'var a="([^"]*)', webpage, 'url')
|
src_url = self._search_regex(r'var a="([^"]*)', webpage, 'url')
|
||||||
except:
|
except:
|
||||||
src_url = 'http://lzscuw.changba.com/{}.{}'.format(str(id), ext)
|
for subdomain in SITE_SUBDOMAINS:
|
||||||
|
try:
|
||||||
|
src_url = 'http://{}.changba.com/{}.{}'.format(
|
||||||
|
subdomain, str(id), ext
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'url': src_url,
|
'url': src_url,
|
||||||
|
Loading…
Reference in New Issue
Block a user