]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/thisoldhouse.py
debian/changelog: Fix spelling of Re-enable to please lintian.
[youtubedl] / youtube_dl / extractor / thisoldhouse.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class ThisOldHouseIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?thisoldhouse\.com/(?:watch|how-to)/(?P<id>[^/?#]+)'
9 _TESTS = [{
10 'url': 'https://www.thisoldhouse.com/how-to/how-to-build-storage-bench',
11 'md5': '568acf9ca25a639f0c4ff905826b662f',
12 'info_dict': {
13 'id': '2REGtUDQ',
14 'ext': 'mp4',
15 'title': 'How to Build a Storage Bench',
16 'description': 'In the workshop, Tom Silva and Kevin O\'Connor build a storage bench for an entryway.',
17 'timestamp': 1442548800,
18 'upload_date': '20150918',
19 }
20 }, {
21 'url': 'https://www.thisoldhouse.com/watch/arlington-arts-crafts-arts-and-crafts-class-begins',
22 'only_matching': True,
23 }]
24
25 def _real_extract(self, url):
26 display_id = self._match_id(url)
27 webpage = self._download_webpage(url, display_id)
28 drupal_settings = self._parse_json(self._search_regex(
29 r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);',
30 webpage, 'drupal settings'), display_id)
31 video_id = drupal_settings['jwplatform']['video_id']
32 return self.url_result('jwplatform:' + video_id, 'JWPlatform', video_id)