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.4 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from .ooyala import OoyalaIE
  4. class TastyTradeIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?tastytrade\.com/tt/shows/[^/]+/episodes/(?P<id>[^/?#&]+)'
  6. _TESTS = [{
  7. 'url': 'https://www.tastytrade.com/tt/shows/market-measures/episodes/correlation-in-short-volatility-06-28-2017',
  8. 'info_dict': {
  9. 'id': 'F3bnlzbToeI6pLEfRyrlfooIILUjz4nM',
  10. 'ext': 'mp4',
  11. 'title': 'A History of Teaming',
  12. 'description': 'md5:2a9033db8da81f2edffa4c99888140b3',
  13. 'duration': 422.255,
  14. },
  15. 'params': {
  16. 'skip_download': True,
  17. },
  18. 'add_ie': ['Ooyala'],
  19. }, {
  20. 'url': 'https://www.tastytrade.com/tt/shows/daily-dose/episodes/daily-dose-06-30-2017',
  21. 'only_matching': True,
  22. }]
  23. def _real_extract(self, url):
  24. display_id = self._match_id(url)
  25. webpage = self._download_webpage(url, display_id)
  26. ooyala_code = self._search_regex(
  27. r'data-media-id=(["\'])(?P<code>(?:(?!\1).)+)\1',
  28. webpage, 'ooyala code', group='code')
  29. info = self._search_json_ld(webpage, display_id, fatal=False)
  30. info.update({
  31. '_type': 'url_transparent',
  32. 'ie_key': OoyalaIE.ie_key(),
  33. 'url': 'ooyala:%s' % ooyala_code,
  34. 'display_id': display_id,
  35. })
  36. return info