]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/thisoldhouse.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_str
6 from ..utils
import try_get
9 class ThisOldHouseIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?thisoldhouse\.com/(?:watch|how-to|tv-episode)/(?P<id>[^/?#]+)'
12 'url': 'https://www.thisoldhouse.com/how-to/how-to-build-storage-bench',
13 'md5': '568acf9ca25a639f0c4ff905826b662f',
17 'title': 'How to Build a Storage Bench',
18 'description': 'In the workshop, Tom Silva and Kevin O\'Connor build a storage bench for an entryway.',
19 'timestamp': 1442548800,
20 'upload_date': '20150918',
23 'url': 'https://www.thisoldhouse.com/watch/arlington-arts-crafts-arts-and-crafts-class-begins',
24 'only_matching': True,
26 'url': 'https://www.thisoldhouse.com/tv-episode/ask-toh-shelf-rough-electric',
27 'only_matching': True,
30 def _real_extract(self
, url
):
31 display_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(url
, display_id
)
33 video_id
= self
._search
_regex
(
34 (r
'data-mid=(["\'])(?P
<id>(?
:(?
!\
1).)+)\
1',
35 r'id=(["\'])inline-video-player-(?P<id>(?:(?!\1).)+)\1'),
36 webpage, 'video id', default=None, group='id')
38 drupal_settings = self._parse_json(self._search_regex(
39 r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);',
40 webpage, 'drupal settings'), display_id)
42 drupal_settings, lambda x: x['jwplatform']['video_id'],
43 compat_str) or list(drupal_settings['comScore'])[0]
44 return self.url_result('jwplatform:' + video_id, 'JWPlatform', video_id)