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 FczenitIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?fc-zenit\.ru/video/gl(?P<id>[0-9]+)'
  7. _TEST = {
  8. 'url': 'http://fc-zenit.ru/video/gl6785/',
  9. 'md5': '458bacc24549173fe5a5aa29174a5606',
  10. 'info_dict': {
  11. 'id': '6785',
  12. 'ext': 'mp4',
  13. 'title': '«Зенит-ТВ»: как Олег Шатов играл против «Урала»',
  14. },
  15. }
  16. def _real_extract(self, url):
  17. video_id = self._match_id(url)
  18. webpage = self._download_webpage(url, video_id)
  19. video_title = self._html_search_regex(r'<div class=\"photoalbum__title\">([^<]+)', webpage, 'title')
  20. bitrates_raw = self._html_search_regex(r'bitrates:.*\n(.*)\]', webpage, 'video URL')
  21. bitrates = re.findall(r'url:.?\'(.+?)\'.*?bitrate:.?([0-9]{3}?)', bitrates_raw)
  22. formats = [{
  23. 'url': furl,
  24. 'tbr': tbr,
  25. } for furl, tbr in bitrates]
  26. self._sort_formats(formats)
  27. return {
  28. 'id': video_id,
  29. 'title': video_title,
  30. 'formats': formats,
  31. }