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.

31 lines
832 B

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