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.

45 lines
1.7 KiB

10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class Varzesh3IE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?video\.varzesh3\.com/(?:[^/]+/)+(?P<id>[^/]+)/?'
  6. _TEST = {
  7. 'url': 'http://video.varzesh3.com/germany/bundesliga/5-%D9%88%D8%A7%DA%A9%D9%86%D8%B4-%D8%A8%D8%B1%D8%AA%D8%B1-%D8%AF%D8%B1%D9%88%D8%A7%D8%B2%D9%87%E2%80%8C%D8%A8%D8%A7%D9%86%D8%A7%D9%86%D8%9B%D9%87%D9%81%D8%AA%D9%87-26-%D8%A8%D9%88%D9%86%D8%AF%D8%B3/',
  8. 'md5': '2a933874cb7dce4366075281eb49e855',
  9. 'info_dict': {
  10. 'id': '76337',
  11. 'ext': 'mp4',
  12. 'title': '۵ واکنش برتر دروازه‌بانان؛هفته ۲۶ بوندسلیگا',
  13. 'description': 'فصل ۲۰۱۵-۲۰۱۴',
  14. 'thumbnail': 're:^https?://.*\.jpg$',
  15. }
  16. }
  17. def _real_extract(self, url):
  18. display_id = self._match_id(url)
  19. webpage = self._download_webpage(url, display_id)
  20. video_url = self._search_regex(
  21. r'<source[^>]+src="([^"]+)"', webpage, 'video url')
  22. title = self._og_search_title(webpage)
  23. description = self._html_search_regex(
  24. r'(?s)<div class="matn">(.+?)</div>',
  25. webpage, 'description', fatal=False)
  26. thumbnail = self._og_search_thumbnail(webpage)
  27. video_id = self._search_regex(
  28. r"<link[^>]+rel='(?:canonical|shortlink)'[^>]+href='/\?p=([^']+)'",
  29. webpage, display_id, default=display_id)
  30. return {
  31. 'url': video_url,
  32. 'id': video_id,
  33. 'title': title,
  34. 'description': description,
  35. 'thumbnail': thumbnail,
  36. }