From 80cc1fc85c833623c9526df5bc800c8eaff881cc Mon Sep 17 00:00:00 2001 From: gkoelln Date: Wed, 8 Feb 2017 10:04:00 -0600 Subject: [PATCH 1/3] Revert "[Bandcamp] Extract additional fields" This reverts commit cc2e170d86152159fb1481677a396af254e2e551. --- youtube_dl/extractor/bandcamp.py | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/youtube_dl/extractor/bandcamp.py b/youtube_dl/extractor/bandcamp.py index 4e8c6245f..88c590e98 100644 --- a/youtube_dl/extractor/bandcamp.py +++ b/youtube_dl/extractor/bandcamp.py @@ -16,7 +16,6 @@ from ..utils import ( int_or_none, parse_filesize, unescapeHTML, - unified_strdate, update_url_query, ) @@ -48,18 +47,6 @@ class BandcampIE(InfoExtractor): mobj = re.match(self._VALID_URL, url) title = mobj.group('title') webpage = self._download_webpage(url, title) - release_date = self._search_regex( - r'"?(?:album_)?release_date"?\s*?:\s*?"(.*?)"', - webpage, 'release date', fatal=False) - release_date = unified_strdate(release_date) - album = self._search_regex( - r'album_title\s*:\s*"((?:\\.|[^"\\])+?)"', - webpage, 'album', default=None) - artist = self._search_regex( - r'artist\s*:\s*"((?:\\.|[^"\\])+?)"', - webpage, 'artist', fatal=False) - if release_date: - release_year = release_date[:4] m_download = re.search(r'freeDownloadPage: "(.*?)"', webpage) if not m_download: m_trackinfo = re.search(r'trackinfo: (.+),\s*?\n', webpage) @@ -89,14 +76,7 @@ class BandcampIE(InfoExtractor): 'id': track_id, 'title': data['title'], 'formats': formats, - 'release_date': release_date, 'duration': float_or_none(data.get('duration')), - 'track': data.get('title'), - 'track_number': int_or_none(data.get('track_num')), - 'track_id': track_id, - 'album': album, - 'artist': artist, - 'release_year': release_year, } else: raise ExtractorError('No free songs found') @@ -106,10 +86,6 @@ class BandcampIE(InfoExtractor): r'(?ms)var TralbumData = .*?[{,]\s*id: (?P\d+),?$', webpage, 'video id') - track_number = self._search_regex( - r'"track_num":(?P\d+),', - webpage, 'track number', fatal=False) - download_webpage = self._download_webpage( download_link, video_id, 'Downloading free downloads page') @@ -169,15 +145,9 @@ class BandcampIE(InfoExtractor): 'title': title, 'thumbnail': info.get('thumb_url'), 'uploader': info.get('artist'), - 'release_date': release_date, 'artist': artist, 'track': track, 'formats': formats, - 'track_number': int_or_none(track_number), - 'track_id': video_id, - 'album': album, - 'artist': artist, - 'release_year': release_year, } @@ -263,6 +233,5 @@ class BandcampAlbumIE(InfoExtractor): 'uploader_id': uploader_id, 'id': playlist_id, 'title': title, - 'album': title, 'entries': entries, } From 0b3db84dc110ec88fa9582a0aa3127fd6ec05fbd Mon Sep 17 00:00:00 2001 From: gkoelln Date: Wed, 8 Feb 2017 10:10:37 -0600 Subject: [PATCH 2/3] [Go] Add Adobe Pass auth Adding Adobe Pass auth --- youtube_dl/extractor/go.py | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/youtube_dl/extractor/go.py b/youtube_dl/extractor/go.py index a34779b16..92eca9cfb 100644 --- a/youtube_dl/extractor/go.py +++ b/youtube_dl/extractor/go.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import re -from .common import InfoExtractor +from .adobepass import AdobePassIE from ..utils import ( int_or_none, determine_ext, @@ -13,7 +13,7 @@ from ..utils import ( ) -class GoIE(InfoExtractor): +class GoIE(AdobePassIE): _BRANDS = { 'abc': '001', 'freeform': '002', @@ -43,16 +43,29 @@ class GoIE(InfoExtractor): sub_domain, video_id, display_id = re.match(self._VALID_URL, url).groups() if not video_id: webpage = self._download_webpage(url, display_id) - video_id = self._search_regex( - # There may be inner quotes, e.g. data-video-id="'VDKA3609139'" - # from http://freeform.go.com/shows/shadowhunters/episodes/season-2/1-this-guilty-blood - r'data-video-id=["\']*VDKA(\w+)', webpage, 'video id') + video_id = self._search_regex(r'data-video-id=["\']VDKA(\w+)', webpage, 'video id') brand = self._BRANDS[sub_domain] video_data = self._download_json( 'http://api.contents.watchabc.go.com/vp2/ws/contents/3000/videos/%s/001/-1/-1/-1/%s/-1/-1.json' % (brand, video_id), video_id)['video'][0] title = video_data['title'] + authdata = {} + if video_data['accesslevel'] == '1': + resource = self._get_mvpd_resource( + 'DisneyXD', title, video_id, + video_data.get('tvrating', {}).get('rating')) + token = self._extract_mvpd_auth( + url, video_id, 'DisneyXD', resource) + authdata.update({ + 'adobe_resource_id': resource, + 'token': token, + 'auth_flag': 1, + 'token_type': 'ap', + 'mvpd': title, + 'adobe_requestor_id': 'DisneyXD', + }) + formats = [] for asset in video_data.get('assets', {}).get('asset', []): asset_url = asset.get('value') @@ -63,14 +76,15 @@ class GoIE(InfoExtractor): if ext == 'm3u8': video_type = video_data.get('type') if video_type == 'lf': + authdata.update({ + 'video_id': video_data['id'], + 'video_type': video_type, + 'brand': brand, + 'device': '001', + }) entitlement = self._download_json( 'https://api.entitlement.watchabc.go.com/vp2/ws-secure/entitlement/2020/authorize.json', - video_id, data=urlencode_postdata({ - 'video_id': video_data['id'], - 'video_type': video_type, - 'brand': brand, - 'device': '001', - })) + video_id, data=urlencode_postdata(authdata)) errors = entitlement.get('errors', {}).get('errors', []) if errors: error_message = ', '.join([error['message'] for error in errors]) From 81c584bfae1a9169ff71e900171736714a2e865f Mon Sep 17 00:00:00 2001 From: gkoelln Date: Wed, 8 Feb 2017 10:30:56 -0600 Subject: [PATCH 3/3] [Go] Restore some previously deleted code Restore some previously deleted code --- youtube_dl/extractor/go.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/go.py b/youtube_dl/extractor/go.py index 92eca9cfb..36a4cd187 100644 --- a/youtube_dl/extractor/go.py +++ b/youtube_dl/extractor/go.py @@ -43,7 +43,10 @@ class GoIE(AdobePassIE): sub_domain, video_id, display_id = re.match(self._VALID_URL, url).groups() if not video_id: webpage = self._download_webpage(url, display_id) - video_id = self._search_regex(r'data-video-id=["\']VDKA(\w+)', webpage, 'video id') + video_id = self._search_regex( + # There may be inner quotes, e.g. data-video-id="'VDKA3609139'" + # from http://freeform.go.com/shows/shadowhunters/episodes/season-2/1-this-guilty-blood + r'data-video-id=["\']*VDKA(\w+)', webpage, 'video id') brand = self._BRANDS[sub_domain] video_data = self._download_json( 'http://api.contents.watchabc.go.com/vp2/ws/contents/3000/videos/%s/001/-1/-1/-1/%s/-1/-1.json' % (brand, video_id),