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.

41 lines
1.2 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class Canalc2IE(InfoExtractor):
  6. IE_NAME = 'canalc2.tv'
  7. _VALID_URL = r'http://.*?\.canalc2\.tv/video\.asp\?.*?idVideo=(?P<id>\d+)'
  8. _TEST = {
  9. 'url': 'http://www.canalc2.tv/video.asp?idVideo=12163&voir=oui',
  10. 'md5': '060158428b650f896c542dfbb3d6487f',
  11. 'info_dict': {
  12. 'id': '12163',
  13. 'ext': 'mp4',
  14. 'title': 'Terrasses du Numérique'
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = re.match(self._VALID_URL, url).group('id')
  19. # We need to set the voir field for getting the file name
  20. url = 'http://www.canalc2.tv/video.asp?idVideo=%s&voir=oui' % video_id
  21. webpage = self._download_webpage(url, video_id)
  22. file_name = self._search_regex(
  23. r"so\.addVariable\('file','(.*?)'\);",
  24. webpage, 'file name')
  25. video_url = 'http://vod-flash.u-strasbg.fr:8080/' + file_name
  26. title = self._html_search_regex(
  27. r'class="evenement8">(.*?)</a>', webpage, 'title')
  28. return {
  29. 'id': video_id,
  30. 'ext': 'mp4',
  31. 'url': video_url,
  32. 'title': title,
  33. }