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.

38 lines
1.1 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class VShareIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?vshare\.io/[dv]/(?P<id>[^/?#&]+)'
  6. _TESTS = [{
  7. 'url': 'https://vshare.io/d/0f64ce6',
  8. 'md5': '16d7b8fef58846db47419199ff1ab3e7',
  9. 'info_dict': {
  10. 'id': '0f64ce6',
  11. 'title': 'vl14062007715967',
  12. 'ext': 'mp4',
  13. }
  14. }, {
  15. 'url': 'https://vshare.io/v/0f64ce6/width-650/height-430/1',
  16. 'only_matching': True,
  17. }]
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(
  21. 'https://vshare.io/d/%s' % video_id, video_id)
  22. title = self._html_search_regex(
  23. r'(?s)<div id="root-container">(.+?)<br/>', webpage, 'title')
  24. video_url = self._search_regex(
  25. r'<a[^>]+href=(["\'])(?P<url>(?:https?:)?//.+?)\1[^>]*>[Cc]lick\s+here',
  26. webpage, 'video url', group='url')
  27. return {
  28. 'id': video_id,
  29. 'title': title,
  30. 'url': video_url,
  31. }