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.

48 lines
1.7 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class GoldenMoustacheIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?goldenmoustache\.com/(?P<display_id>[\w-]+)-(?P<id>\d+)'
  5. _TESTS = [{
  6. 'url': 'http://www.goldenmoustache.com/suricate-le-poker-3700/',
  7. 'md5': '0f904432fa07da5054d6c8beb5efb51a',
  8. 'info_dict': {
  9. 'id': '3700',
  10. 'ext': 'mp4',
  11. 'title': 'Suricate - Le Poker',
  12. 'description': 'md5:3d1f242f44f8c8cb0a106f1fd08e5dc9',
  13. 'thumbnail': 're:^https?://.*\.jpg$',
  14. }
  15. }, {
  16. 'url': 'http://www.goldenmoustache.com/le-lab-tout-effacer-mc-fly-et-carlito-55249/',
  17. 'md5': '27f0c50fb4dd5f01dc9082fc67cd5700',
  18. 'info_dict': {
  19. 'id': '55249',
  20. 'ext': 'mp4',
  21. 'title': 'Le LAB - Tout Effacer (Mc Fly et Carlito)',
  22. 'description': 'md5:9b7fbf11023fb2250bd4b185e3de3b2a',
  23. 'thumbnail': 're:^https?://.*\.(?:png|jpg)$',
  24. }
  25. }]
  26. def _real_extract(self, url):
  27. video_id = self._match_id(url)
  28. webpage = self._download_webpage(url, video_id)
  29. video_url = self._html_search_regex(
  30. r'data-src-type="mp4" data-src="([^"]+)"', webpage, 'video URL')
  31. title = self._html_search_regex(
  32. r'<title>(.*?)(?: - Golden Moustache)?</title>', webpage, 'title')
  33. thumbnail = self._og_search_thumbnail(webpage)
  34. description = self._og_search_description(webpage)
  35. return {
  36. 'id': video_id,
  37. 'url': video_url,
  38. 'ext': 'mp4',
  39. 'title': title,
  40. 'description': description,
  41. 'thumbnail': thumbnail,
  42. }