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.

32 lines
858 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/0qr9sai2veej4f8/THE_DOCTOR_GAMES.mp4',
  10. 'md5': '8ae17c51172fb7f93bdd6a214cc8c896',
  11. 'info_dict': {
  12. 'id': '0qr9sai2veej4f8',
  13. 'ext': 'mp4',
  14. 'title': 'THE_DOCTOR_GAMES'
  15. }
  16. }
  17. def _real_extract(self, url):
  18. mobj = re.match(self._VALID_URL, url)
  19. video_id = mobj.group('id')
  20. title = os.path.splitext(mobj.group('title'))[0]
  21. video_url = url + '?dl=1'
  22. return {
  23. 'id': video_id,
  24. 'title': title,
  25. 'url': video_url,
  26. }