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.

37 lines
1.1 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import os.path
  4. import re
  5. from .common import InfoExtractor
  6. class SaveFromIE(InfoExtractor):
  7. IE_NAME = 'savefrom.net'
  8. _VALID_URL = r'https?://[^.]+\.savefrom\.net/\#url=(?P<url>.*)$'
  9. _TEST = {
  10. 'url': 'http://en.savefrom.net/#url=http://youtube.com/watch?v=UlVRAPW2WJY&utm_source=youtube.com&utm_medium=short_domains&utm_campaign=ssyoutube.com',
  11. 'info_dict': {
  12. 'id': 'UlVRAPW2WJY',
  13. 'ext': 'mp4',
  14. 'title': 'About Team Radical MMA | MMA Fighting',
  15. 'upload_date': '20120816',
  16. 'uploader': 'Howcast',
  17. 'uploader_id': 'Howcast',
  18. 'description': 're:(?s).* Hi, my name is Rene Dreifuss\. And I\'m here to show you some MMA.*',
  19. },
  20. 'params': {
  21. 'skip_download': True
  22. }
  23. }
  24. def _real_extract(self, url):
  25. mobj = re.match(self._VALID_URL, url)
  26. video_id = os.path.splitext(url.split('/')[-1])[0]
  27. return {
  28. '_type': 'url',
  29. 'id': video_id,
  30. 'url': mobj.group('url'),
  31. }