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.

30 lines
796 B

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