diff options
author | Ashish Gupta <39122144+Ashish0804@users.noreply.github.com> | 2022-01-18 13:10:55 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 13:10:55 +0530 |
commit | eea1b0358e8f6d0c41121b811df6d320f4b73673 (patch) | |
tree | d9a491ffbea6667da8dc258c74c0df42c929975d | |
parent | 32b95bb6436fd17ee21cd55217f16361d4e7494a (diff) | |
download | hypervideo-pre-eea1b0358e8f6d0c41121b811df6d320f4b73673.tar.lz hypervideo-pre-eea1b0358e8f6d0c41121b811df6d320f4b73673.tar.xz hypervideo-pre-eea1b0358e8f6d0c41121b811df6d320f4b73673.zip |
[ThisOldHouseIE] Add support for premium videos (#2358)
Authored by: Ashish0804
Closes: #2341
-rw-r--r-- | yt_dlp/extractor/thisoldhouse.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/yt_dlp/extractor/thisoldhouse.py b/yt_dlp/extractor/thisoldhouse.py index a3d9b4017..35c69a988 100644 --- a/yt_dlp/extractor/thisoldhouse.py +++ b/yt_dlp/extractor/thisoldhouse.py @@ -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) |