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.

54 lines
2.2 KiB

11 years ago
11 years ago
11 years ago
9 years ago
10 years ago
9 years ago
11 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class TF1IE(InfoExtractor):
  5. """TF1 uses the wat.tv player."""
  6. _VALID_URL = r'https?://(?:(?:videos|www|lci)\.tf1|(?:www\.)?(?:tfou|ushuaiatv|histoire|tvbreizh))\.fr/(?:[^/]+/)*(?P<id>[^/?#.]+)'
  7. _TESTS = [{
  8. 'url': 'http://videos.tf1.fr/auto-moto/citroen-grand-c4-picasso-2013-presentation-officielle-8062060.html',
  9. 'info_dict': {
  10. 'id': '10635995',
  11. 'ext': 'mp4',
  12. 'title': 'Citroën Grand C4 Picasso 2013 : présentation officielle',
  13. 'description': 'Vidéo officielle du nouveau Citroën Grand C4 Picasso, lancé à l\'automne 2013.',
  14. },
  15. 'params': {
  16. # Sometimes wat serves the whole file with the --test option
  17. 'skip_download': True,
  18. },
  19. 'expected_warnings': ['HTTP Error 404'],
  20. }, {
  21. 'url': 'http://www.tfou.fr/chuggington/videos/le-grand-mysterioso-chuggington-7085291-739.html',
  22. 'info_dict': {
  23. 'id': 'le-grand-mysterioso-chuggington-7085291-739',
  24. 'ext': 'mp4',
  25. 'title': 'Le grand Mystérioso - Chuggington',
  26. 'description': 'Le grand Mystérioso - Emery rêve qu\'un article lui soit consacré dans le journal.',
  27. 'upload_date': '20150103',
  28. },
  29. 'params': {
  30. # Sometimes wat serves the whole file with the --test option
  31. 'skip_download': True,
  32. },
  33. 'skip': 'HTTP Error 410: Gone',
  34. }, {
  35. 'url': 'http://www.tf1.fr/tf1/koh-lanta/videos/replay-koh-lanta-22-mai-2015.html',
  36. 'only_matching': True,
  37. }, {
  38. 'url': 'http://lci.tf1.fr/sept-a-huit/videos/sept-a-huit-du-24-mai-2015-8611550.html',
  39. 'only_matching': True,
  40. }, {
  41. 'url': 'http://www.tf1.fr/hd1/documentaire/videos/mylene-farmer-d-une-icone.html',
  42. 'only_matching': True,
  43. }]
  44. def _real_extract(self, url):
  45. video_id = self._match_id(url)
  46. webpage = self._download_webpage(url, video_id)
  47. wat_id = self._html_search_regex(
  48. r'(["\'])(?:https?:)?//www\.wat\.tv/embedframe/.*?(?P<id>\d{8})\1',
  49. webpage, 'wat id', group='id')
  50. return self.url_result('wat:%s' % wat_id, 'Wat')