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.

31 lines
954 B

  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[0-9]+)/.*'
  6. def _real_extract(self,url):
  7. mobj = re.match(self._VALID_URL, url)
  8. video_id = mobj.group('id')
  9. mrss_url='http://player.ina.fr/notices/%s.mrss' % video_id
  10. video_extension = 'mp4'
  11. webpage = self._download_webpage(mrss_url, video_id)
  12. self.report_extraction(video_id)
  13. video_url = self._html_search_regex(r'<media:player url="(?P<mp4url>http://mp4.ina.fr/[^"]+\.mp4)',
  14. webpage, u'video URL')
  15. video_title = self._search_regex(r'<title><!\[CDATA\[(?P<titre>.*?)]]></title>',
  16. webpage, u'title')
  17. return [{
  18. 'id': video_id,
  19. 'url': video_url,
  20. 'ext': video_extension,
  21. 'title': video_title,
  22. }]