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