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.

36 lines
1.0 KiB

  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class InaIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?ina\.fr/video/(?P<id>I?[A-Z0-9]+)'
  7. _TEST = {
  8. 'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
  9. 'md5': 'a667021bf2b41f8dc6049479d9bb38a3',
  10. 'info_dict': {
  11. 'id': 'I12055569',
  12. 'ext': 'mp4',
  13. 'title': 'François Hollande "Je crois que c\'est clair"',
  14. }
  15. }
  16. def _real_extract(self, url):
  17. mobj = re.match(self._VALID_URL, url)
  18. video_id = mobj.group('id')
  19. mrss_url = 'http://player.ina.fr/notices/%s.mrss' % video_id
  20. info_doc = self._download_xml(mrss_url, video_id)
  21. self.report_extraction(video_id)
  22. video_url = info_doc.find('.//{http://search.yahoo.com/mrss/}player').attrib['url']
  23. return {
  24. 'id': video_id,
  25. 'url': video_url,
  26. 'title': info_doc.find('.//title').text,
  27. }