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.

44 lines
1.4 KiB

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