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.

56 lines
2.1 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class TMZIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?tmz\.com/videos/(?P<id>[^/?#]+)'
  6. _TESTS = [{
  7. 'url': 'http://www.tmz.com/videos/0_okj015ty/',
  8. 'md5': '4d22a51ef205b6c06395d8394f72d560',
  9. 'info_dict': {
  10. 'id': '0_okj015ty',
  11. 'ext': 'mp4',
  12. 'title': 'Kim Kardashian\'s Boobs Unlock a Mystery!',
  13. 'description': 'Did Kim Kardasain try to one-up Khloe by one-upping Kylie??? Or is she just showing off her amazing boobs?',
  14. 'timestamp': 1394747163,
  15. 'uploader_id': 'batchUser',
  16. 'upload_date': '20140313',
  17. }
  18. }, {
  19. 'url': 'http://www.tmz.com/videos/0-cegprt2p/',
  20. 'only_matching': True,
  21. }]
  22. def _real_extract(self, url):
  23. video_id = self._match_id(url).replace('-', '_')
  24. return self.url_result('kaltura:591531:%s' % video_id, 'Kaltura', video_id)
  25. class TMZArticleIE(InfoExtractor):
  26. _VALID_URL = r'https?://(?:www\.)?tmz\.com/\d{4}/\d{2}/\d{2}/(?P<id>[^/]+)/?'
  27. _TEST = {
  28. 'url': 'http://www.tmz.com/2015/04/19/bobby-brown-bobbi-kristina-awake-video-concert',
  29. 'md5': '3316ff838ae5bb7f642537825e1e90d2',
  30. 'info_dict': {
  31. 'id': '0_6snoelag',
  32. 'ext': 'mov',
  33. 'title': 'Bobby Brown Tells Crowd ... Bobbi Kristina is Awake',
  34. 'description': 'Bobby Brown stunned his audience during a concert Saturday night, when he told the crowd, "Bobbi is awake. She\'s watching me."',
  35. 'timestamp': 1429467813,
  36. 'upload_date': '20150419',
  37. 'uploader_id': 'batchUser',
  38. }
  39. }
  40. def _real_extract(self, url):
  41. video_id = self._match_id(url)
  42. webpage = self._download_webpage(url, video_id)
  43. embedded_video_info = self._parse_json(self._html_search_regex(
  44. r'tmzVideoEmbed\(({.+?})\);', webpage, 'embedded video info'),
  45. video_id)
  46. return self.url_result(
  47. 'http://www.tmz.com/videos/%s/' % embedded_video_info['id'])