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.

53 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. }, {
  20. 'url': 'http://www.tfou.fr/chuggington/videos/le-grand-mysterioso-chuggington-7085291-739.html',
  21. 'info_dict': {
  22. 'id': 'le-grand-mysterioso-chuggington-7085291-739',
  23. 'ext': 'mp4',
  24. 'title': 'Le grand Mystérioso - Chuggington',
  25. 'description': 'Le grand Mystérioso - Emery rêve qu\'un article lui soit consacré dans le journal.',
  26. 'upload_date': '20150103',
  27. },
  28. 'params': {
  29. # Sometimes wat serves the whole file with the --test option
  30. 'skip_download': True,
  31. },
  32. 'skip': 'HTTP Error 410: Gone',
  33. }, {
  34. 'url': 'http://www.tf1.fr/tf1/koh-lanta/videos/replay-koh-lanta-22-mai-2015.html',
  35. 'only_matching': True,
  36. }, {
  37. 'url': 'http://lci.tf1.fr/sept-a-huit/videos/sept-a-huit-du-24-mai-2015-8611550.html',
  38. 'only_matching': True,
  39. }, {
  40. 'url': 'http://www.tf1.fr/hd1/documentaire/videos/mylene-farmer-d-une-icone.html',
  41. 'only_matching': True,
  42. }]
  43. def _real_extract(self, url):
  44. video_id = self._match_id(url)
  45. webpage = self._download_webpage(url, video_id)
  46. wat_id = self._html_search_regex(
  47. r'(["\'])(?:https?:)?//www\.wat\.tv/embedframe/.*?(?P<id>\d{8})\1',
  48. webpage, 'wat id', group='id')
  49. return self.url_result('wat:%s' % wat_id, 'Wat')