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.

38 lines
1.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class GazetaIE(InfoExtractor):
  6. _VALID_URL = r'(?P<url>https?://(?:www\.)?gazeta\.ru/(?:[^/]+/)?video/(?:(?:main|\d{4}/\d{2}/\d{2})/)?(?P<id>[A-Za-z0-9-_.]+)\.s?html)'
  7. _TESTS = [{
  8. 'url': 'http://www.gazeta.ru/video/main/zadaite_vopros_vladislavu_yurevichu.shtml',
  9. 'md5': 'd49c9bdc6e5a7888f27475dc215ee789',
  10. 'info_dict': {
  11. 'id': '205566',
  12. 'ext': 'mp4',
  13. 'title': '«70–80 процентов гражданских в Донецке на грани голода»',
  14. 'description': 'md5:38617526050bd17b234728e7f9620a71',
  15. 'thumbnail': 're:^https?://.*\.jpg',
  16. },
  17. }, {
  18. 'url': 'http://www.gazeta.ru/lifestyle/video/2015/03/08/master-klass_krasivoi_byt._delaem_vesennii_makiyazh.shtml',
  19. 'only_matching': True,
  20. }]
  21. def _real_extract(self, url):
  22. mobj = re.match(self._VALID_URL, url)
  23. display_id = mobj.group('id')
  24. embed_url = '%s?p=embed' % mobj.group('url')
  25. embed_page = self._download_webpage(
  26. embed_url, display_id, 'Downloading embed page')
  27. video_id = self._search_regex(
  28. r'<div[^>]*?class="eagleplayer"[^>]*?data-id="([^"]+)"', embed_page, 'video id')
  29. return self.url_result(
  30. 'eagleplatform:gazeta.media.eagleplatform.com:%s' % video_id, 'EaglePlatform')