mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 00:52:01 +00:00
[ThisOldHouseIE] Add support for premium videos (#2358)
Authored by: Ashish0804 Closes: #2341
This commit is contained in:
parent
32b95bb643
commit
eea1b0358e
@ -2,6 +2,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import HEADRequest
|
||||
|
||||
|
||||
class ThisOldHouseIE(InfoExtractor):
|
||||
@ -15,6 +16,11 @@ class ThisOldHouseIE(InfoExtractor):
|
||||
'description': 'In the workshop, Tom Silva and Kevin O\'Connor build a storage bench for an entryway.',
|
||||
'timestamp': 1442548800,
|
||||
'upload_date': '20150918',
|
||||
'duration': 674,
|
||||
'view_count': int,
|
||||
'average_rating': 0,
|
||||
'thumbnail': r're:^https?://.*\.jpg\?\d+$',
|
||||
'display_id': 'how-to-build-a-storage-bench',
|
||||
},
|
||||
'params': {
|
||||
'skip_download': True,
|
||||
@ -41,7 +47,12 @@ class ThisOldHouseIE(InfoExtractor):
|
||||
def _real_extract(self, url):
|
||||
display_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, display_id)
|
||||
video_id = self._search_regex(
|
||||
r'<iframe[^>]+src=[\'"](?:https?:)?//(?:www\.)?thisoldhouse\.(?:chorus\.build|com)/videos/zype/([0-9a-f]{24})',
|
||||
webpage, 'video id')
|
||||
if 'To Unlock This content' in webpage:
|
||||
self.raise_login_required(method='cookies')
|
||||
video_url = self._search_regex(
|
||||
r'<iframe[^>]+src=[\'"]((?:https?:)?//(?:www\.)?thisoldhouse\.(?:chorus\.build|com)/videos/zype/([0-9a-f]{24})[^\'"]*)[\'"]',
|
||||
webpage, 'video url')
|
||||
if 'subscription_required=true' in video_url:
|
||||
return self.url_result(self._request_webpage(HEADRequest(video_url), display_id).geturl(), 'Zype', display_id)
|
||||
video_id = self._search_regex(r'(?:https?:)?//(?:www\.)?thisoldhouse\.(?:chorus\.build|com)/videos/zype/([0-9a-f]{24})', video_url, 'video id')
|
||||
return self.url_result(self._ZYPE_TMPL % video_id, 'Zype', video_id)
|
||||
|
Loading…
Reference in New Issue
Block a user