From 75be8e5e25179ac5ee448888c962f5e7a7d381f6 Mon Sep 17 00:00:00 2001 From: Julian Galperin Date: Fri, 19 Apr 2019 10:25:04 -0400 Subject: [PATCH] cleaned up code --- youtube_dl/extractor/changba.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/changba.py b/youtube_dl/extractor/changba.py index deebf57c0..6d8b07b21 100644 --- a/youtube_dl/extractor/changba.py +++ b/youtube_dl/extractor/changba.py @@ -19,6 +19,7 @@ class ChangbaIE(InfoExtractor): 'id': '1146278955', 'ext': 'mp4', 'title': ' ', + 'vcodec': None } }, { 'url': 'http://changba.com/s/nZqfbS_vCnieNNjJ7UiEGw?', @@ -27,23 +28,24 @@ class ChangbaIE(InfoExtractor): 'id': '1091968526', 'ext': 'mp3', 'title': '下雪 ', + 'vcodec': 'none' } }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - # print(webpage) id = self._search_regex(r'workid=([0-9]+)', webpage, 'id') title = self._search_regex( r']+class="title"[^>]*>([^<]+)', webpage, 'title' ) - print(title) - # title = self._og_search_title(webpage) ext = None + vcodec = None + try: src_url = self._search_regex(r'var a="([^"]*)', webpage, 'url') ext = 'mp3' + vcodec = 'none' except RegexNotFoundError: encoded = self._search_regex( r'video_url: \'([0-9A-Za-z]+=*)', webpage, 'video url' @@ -51,10 +53,10 @@ class ChangbaIE(InfoExtractor): src_url = base64.b64decode(encoded).decode('utf-8') ext = 'mp4' - return { 'url': src_url, 'id': id, 'ext': ext, 'title': title, + 'vcodec': vcodec }