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.

90 lines
2.9 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from .arkena import ArkenaIE
  5. class LcpPlayIE(ArkenaIE):
  6. _VALID_URL = r'https?://play\.lcp\.fr/embed/(?P<id>[^/]+)/(?P<account_id>[^/]+)/[^/]+/[^/]+'
  7. _TESTS = [{
  8. 'url': 'http://play.lcp.fr/embed/327336/131064/darkmatter/0',
  9. 'md5': 'b8bd9298542929c06c1c15788b1f277a',
  10. 'info_dict': {
  11. 'id': '327336',
  12. 'ext': 'mp4',
  13. 'title': '327336',
  14. 'timestamp': 1456391602,
  15. 'upload_date': '20160225',
  16. },
  17. 'params': {
  18. 'skip_download': True,
  19. },
  20. }]
  21. class LcpIE(InfoExtractor):
  22. _VALID_URL = r'https?://(?:www\.)?lcp\.fr/(?:[^/]+/)*(?P<id>[^/]+)'
  23. _TESTS = [{
  24. # arkena embed
  25. 'url': 'http://www.lcp.fr/la-politique-en-video/schwartzenberg-prg-preconise-francois-hollande-de-participer-une-primaire',
  26. 'md5': 'b8bd9298542929c06c1c15788b1f277a',
  27. 'info_dict': {
  28. 'id': 'd56d03e9',
  29. 'ext': 'mp4',
  30. 'title': 'Schwartzenberg (PRG) préconise à François Hollande de participer à une primaire à gauche',
  31. 'description': 'md5:96ad55009548da9dea19f4120c6c16a8',
  32. 'timestamp': 1456488895,
  33. 'upload_date': '20160226',
  34. },
  35. 'params': {
  36. 'skip_download': True,
  37. },
  38. }, {
  39. # dailymotion live stream
  40. 'url': 'http://www.lcp.fr/le-direct',
  41. 'info_dict': {
  42. 'id': 'xji3qy',
  43. 'ext': 'mp4',
  44. 'title': 'La Chaine Parlementaire (LCP), Live TNT',
  45. 'description': 'md5:5c69593f2de0f38bd9a949f2c95e870b',
  46. 'uploader': 'LCP',
  47. 'uploader_id': 'xbz33d',
  48. 'timestamp': 1308923058,
  49. 'upload_date': '20110624',
  50. },
  51. 'params': {
  52. # m3u8 live stream
  53. 'skip_download': True,
  54. },
  55. }, {
  56. 'url': 'http://www.lcp.fr/emissions/277792-les-volontaires',
  57. 'only_matching': True,
  58. }]
  59. def _real_extract(self, url):
  60. display_id = self._match_id(url)
  61. webpage = self._download_webpage(url, display_id)
  62. play_url = self._search_regex(
  63. r'<iframe[^>]+src=(["\'])(?P<url>%s?(?:(?!\1).)*)\1' % LcpPlayIE._VALID_URL,
  64. webpage, 'play iframe', default=None, group='url')
  65. if not play_url:
  66. return self.url_result(url, 'Generic')
  67. title = self._og_search_title(webpage, default=None) or self._html_search_meta(
  68. 'twitter:title', webpage, fatal=True)
  69. description = self._html_search_meta(
  70. ('description', 'twitter:description'), webpage)
  71. return {
  72. '_type': 'url_transparent',
  73. 'ie_key': LcpPlayIE.ie_key(),
  74. 'url': play_url,
  75. 'display_id': display_id,
  76. 'title': title,
  77. 'description': description,
  78. }