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.

46 lines
1.4 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..compat import (
  4. compat_urllib_parse,
  5. )
  6. class XBefIE(InfoExtractor):
  7. _VALID_URL = r'http://(?:www\.)?xbef\.com/video/(?P<id>[0-9]+)'
  8. _TEST = {
  9. 'url': 'http://xbef.com/video/5119-glamourous-lesbians-smoking-drinking-and-fucking',
  10. 'md5': 'a478b565baff61634a98f5e5338be995',
  11. 'info_dict': {
  12. 'id': '5119',
  13. 'ext': 'mp4',
  14. 'title': 'md5:7358a9faef8b7b57acda7c04816f170e',
  15. 'age_limit': 18,
  16. 'thumbnail': 're:^http://.*\.jpg',
  17. }
  18. }
  19. def _real_extract(self, url):
  20. video_id = self._match_id(url)
  21. webpage = self._download_webpage(url, video_id)
  22. title = self._html_search_regex(
  23. r'<h1[^>]*>(.*?)</h1>', webpage, 'title')
  24. config_url_enc = self._download_webpage(
  25. 'http://xbef.com/Main/GetVideoURLEncoded/%s' % video_id, video_id,
  26. note='Retrieving config URL')
  27. config_url = compat_urllib_parse.unquote(config_url_enc)
  28. config = self._download_xml(
  29. config_url, video_id, note='Retrieving config')
  30. video_url = config.find('./file').text
  31. thumbnail = config.find('./image').text
  32. return {
  33. 'id': video_id,
  34. 'url': video_url,
  35. 'title': title,
  36. 'thumbnail': thumbnail,
  37. 'age_limit': 18,
  38. }