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.

39 lines
1.2 KiB

  1. import re
  2. from .common import InfoExtractor
  3. class InaIE(InfoExtractor):
  4. """Information Extractor for Ina.fr"""
  5. _VALID_URL = r'(?:http://)?(?:www\.)?ina\.fr/video/(?P<id>I?[A-F0-9]+)/.*'
  6. _TEST = {
  7. u'url': u'www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
  8. u'file': u'I12055569.mp4',
  9. u'md5': u'a667021bf2b41f8dc6049479d9bb38a3',
  10. u'info_dict': {
  11. u"title": u"Fran\u00e7ois Hollande \"Je crois que c'est clair\""
  12. }
  13. }
  14. def _real_extract(self,url):
  15. mobj = re.match(self._VALID_URL, url)
  16. video_id = mobj.group('id')
  17. mrss_url='http://player.ina.fr/notices/%s.mrss' % video_id
  18. video_extension = 'mp4'
  19. webpage = self._download_webpage(mrss_url, video_id)
  20. self.report_extraction(video_id)
  21. video_url = self._html_search_regex(r'<media:player url="(?P<mp4url>http://mp4.ina.fr/[^"]+\.mp4)',
  22. webpage, u'video URL')
  23. video_title = self._search_regex(r'<title><!\[CDATA\[(?P<titre>.*?)]]></title>',
  24. webpage, u'title')
  25. return [{
  26. 'id': video_id,
  27. 'url': video_url,
  28. 'ext': video_extension,
  29. 'title': video_title,
  30. }]