]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/dropbox.py
[thisav] Simplify and use unicode literals
[youtube-dl] / youtube_dl / extractor / dropbox.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 DropboxIE(InfoExtractor):
11     _VALID_URL = r'https?://(?:www\.)?dropbox[.]com/s/(?P<id>[a-zA-Z0-9]{15})/(?P<title>[^?#]*)'
12     _TEST = {
13         'url': 'https://www.dropbox.com/s/mcnzehi9wo55th4/20131219_085616.mp4',
14         'file': 'mcnzehi9wo55th4.mp4',
15         'md5': 'f6d65b1b326e82fd7ab7720bea3dacae',
16         'info_dict': {
17             'title': '20131219_085616'
18         }
19     }
20
21     def _real_extract(self, url):
22         mobj = re.match(self._VALID_URL, url)
23         video_id = mobj.group('id')
24         title = os.path.splitext(mobj.group('title'))[0]
25         video_url = url + '?dl=1'
26
27         return {
28             'id': video_id,
29             'title': title,
30             'url': video_url,
31         }