]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/thisoldhouse.py
Prepare new release.
[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|tv-episode)/(?P<id>[^/?#]+)'
9 _TESTS = [{
10 'url': 'https://www.thisoldhouse.com/how-to/how-to-build-storage-bench',
11 'md5': '946f05bbaa12a33f9ae35580d2dfcfe3',
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 'url': 'https://www.thisoldhouse.com/tv-episode/ask-toh-shelf-rough-electric',
25 'only_matching': True,
26 }]
27
28 def _real_extract(self, url):
29 display_id = self._match_id(url)
30 webpage = self._download_webpage(url, display_id)
31 drupal_settings = self._parse_json(self._search_regex(
32 r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);',
33 webpage, 'drupal settings'), display_id)
34 video_id = drupal_settings['jwplatform']['video_id']
35 return self.url_result('jwplatform:' + video_id, 'JWPlatform', video_id)