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.

58 lines
2.3 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class LemondeIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:.+?\.)?lemonde\.fr/(?:[^/]+/)*(?P<id>[^/]+)\.html'
  5. _TESTS = [{
  6. 'url': 'http://www.lemonde.fr/police-justice/video/2016/01/19/comprendre-l-affaire-bygmalion-en-cinq-minutes_4849702_1653578.html',
  7. 'md5': 'da120c8722d8632eec6ced937536cc98',
  8. 'info_dict': {
  9. 'id': 'lqm3kl',
  10. 'ext': 'mp4',
  11. 'title': "Comprendre l'affaire Bygmalion en 5 minutes",
  12. 'thumbnail': r're:^https?://.*\.jpg',
  13. 'duration': 309,
  14. 'upload_date': '20160119',
  15. 'timestamp': 1453194778,
  16. 'uploader_id': '3pmkp',
  17. },
  18. }, {
  19. # standard iframe embed
  20. 'url': 'http://www.lemonde.fr/les-decodeurs/article/2016/10/18/tout-comprendre-du-ceta-le-petit-cousin-du-traite-transatlantique_5015920_4355770.html',
  21. 'info_dict': {
  22. 'id': 'uzsxms',
  23. 'ext': 'mp4',
  24. 'title': "CETA : quelles suites pour l'accord commercial entre l'Europe et le Canada ?",
  25. 'thumbnail': r're:^https?://.*\.jpg',
  26. 'duration': 325,
  27. 'upload_date': '20161021',
  28. 'timestamp': 1477044540,
  29. 'uploader_id': '3pmkp',
  30. },
  31. 'params': {
  32. 'skip_download': True,
  33. },
  34. }, {
  35. 'url': 'http://redaction.actu.lemonde.fr/societe/video/2016/01/18/calais-debut-des-travaux-de-defrichement-dans-la-jungle_4849233_3224.html',
  36. 'only_matching': True,
  37. }, {
  38. # YouTube embeds
  39. 'url': 'http://www.lemonde.fr/pixels/article/2016/12/09/pourquoi-pewdiepie-superstar-de-youtube-a-menace-de-fermer-sa-chaine_5046649_4408996.html',
  40. 'only_matching': True,
  41. }]
  42. def _real_extract(self, url):
  43. display_id = self._match_id(url)
  44. webpage = self._download_webpage(url, display_id)
  45. digiteka_url = self._proto_relative_url(self._search_regex(
  46. r'url\s*:\s*(["\'])(?P<url>(?:https?://)?//(?:www\.)?(?:digiteka\.net|ultimedia\.com)/deliver/.+?)\1',
  47. webpage, 'digiteka url', group='url', default=None))
  48. if digiteka_url:
  49. return self.url_result(digiteka_url, 'Digiteka')
  50. return self.url_result(url, 'Generic')