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.

42 lines
1.3 KiB

  1. import re
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. clean_html,
  5. compat_parse_qs,
  6. )
  7. class Ro220IE(InfoExtractor):
  8. IE_NAME = '220.ro'
  9. _VALID_URL = r'(?x)(?:https?://)?(?:www\.)?220\.ro/(?P<category>[^/]+)/(?P<shorttitle>[^/]+)/(?P<video_id>[^/]+)'
  10. _TEST = {
  11. u"url": u"http://www.220.ro/sport/Luati-Le-Banii-Sez-4-Ep-1/LYV6doKo7f/",
  12. u'file': u'LYV6doKo7f.mp4',
  13. u'md5': u'03af18b73a07b4088753930db7a34add',
  14. u'info_dict': {
  15. u"title": u"Luati-le Banii sez 4 ep 1",
  16. u"description": u"Iata-ne reveniti dupa o binemeritata vacanta. Va astept si pe Facebook cu pareri si comentarii.",
  17. }
  18. }
  19. def _real_extract(self, url):
  20. mobj = re.match(self._VALID_URL, url)
  21. video_id = mobj.group('video_id')
  22. webpage = self._download_webpage(url, video_id)
  23. flashVars_str = self._search_regex(
  24. r'<param name="flashVars" value="([^"]+)"',
  25. webpage, u'flashVars')
  26. flashVars = compat_parse_qs(flashVars_str)
  27. info = {
  28. '_type': 'video',
  29. 'id': video_id,
  30. 'ext': 'mp4',
  31. 'url': flashVars['videoURL'][0],
  32. 'title': flashVars['title'][0],
  33. 'description': clean_html(flashVars['desc'][0]),
  34. 'thumbnail': flashVars['preview'][0],
  35. }
  36. return info