You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.8 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class ThisOldHouseIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?thisoldhouse\.com/(?:watch|how-to|tv-episode|(?:[^/]+/)?\d+)/(?P<id>[^/?#]+)'
  6. _TESTS = [{
  7. 'url': 'https://www.thisoldhouse.com/how-to/how-to-build-storage-bench',
  8. 'info_dict': {
  9. 'id': '5dcdddf673c3f956ef5db202',
  10. 'ext': 'mp4',
  11. 'title': 'How to Build a Storage Bench',
  12. 'description': 'In the workshop, Tom Silva and Kevin O\'Connor build a storage bench for an entryway.',
  13. 'timestamp': 1442548800,
  14. 'upload_date': '20150918',
  15. },
  16. 'params': {
  17. 'skip_download': True,
  18. },
  19. }, {
  20. 'url': 'https://www.thisoldhouse.com/watch/arlington-arts-crafts-arts-and-crafts-class-begins',
  21. 'only_matching': True,
  22. }, {
  23. 'url': 'https://www.thisoldhouse.com/tv-episode/ask-toh-shelf-rough-electric',
  24. 'only_matching': True,
  25. }, {
  26. 'url': 'https://www.thisoldhouse.com/furniture/21017078/how-to-build-a-storage-bench',
  27. 'only_matching': True,
  28. }, {
  29. 'url': 'https://www.thisoldhouse.com/21113884/s41-e13-paradise-lost',
  30. 'only_matching': True,
  31. }]
  32. _ZYPE_TMPL = 'https://player.zype.com/embed/%s.html?api_key=hsOk_yMSPYNrT22e9pu8hihLXjaZf0JW5jsOWv4ZqyHJFvkJn6rtToHl09tbbsbe'
  33. def _real_extract(self, url):
  34. display_id = self._match_id(url)
  35. webpage = self._download_webpage(url, display_id)
  36. video_id = self._search_regex(
  37. r'<iframe[^>]+src=[\'"](?:https?:)?//thisoldhouse\.chorus\.build/videos/zype/([0-9a-f]{24})',
  38. webpage, 'video id')
  39. return self.url_result(self._ZYPE_TMPL % video_id, 'Zype', video_id)