[dropbox] PEP8 and simplify (#2171)
[youtube-dl] / youtube_dl / extractor / dropbox.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class DropboxIE(InfoExtractor):
10     _VALID_URL = r'https?://(?:www\.)?dropbox[.]com/s/(?P<id>[a-zA-Z0-9]{15})/(?P<title>[^?#]*)'
11     _TEST = {
12         'url': 'https://www.dropbox.com/s/mcnzehi9wo55th4/20131219_085616.mp4',
13         'file': 'mcnzehi9wo55th4.mp4',
14         'md5': '2cec58eb277054eca0dbaaf3bdc72564',
15         'info_dict': {
16             'title': '20131219_085616'
17         }
18     }
19
20     def _real_extract(self, url):
21         mobj = re.match(self._VALID_URL, url)
22         video_id = mobj.group('id')
23         title = mobj.group('title')
24         video_url = url + '?dl=1'
25
26         return {
27             'id': video_id,
28             'title': title,
29             'url': video_url,
30         }