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.

43 lines
1.4 KiB

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