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.

49 lines
1.7 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import json
  4. import re
  5. from .common import InfoExtractor
  6. from .youtube import YoutubeIE
  7. class JadoreCettePubIE(InfoExtractor):
  8. _VALID_URL = r'http://(?:www\.)?jadorecettepub\.com/[0-9]{4}/[0-9]{2}/(?P<id>.*?)\.html'
  9. _TEST = {
  10. 'url': 'http://www.jadorecettepub.com/2010/12/star-wars-massacre-par-les-japonais.html',
  11. 'md5': '401286a06067c70b44076044b66515de',
  12. 'info_dict': {
  13. 'id': 'jLMja3tr7a4',
  14. 'ext': 'mp4',
  15. 'title': 'La pire utilisation de Star Wars',
  16. 'description': "Jadorecettepub.com vous a gratifié de plusieurs pubs géniales utilisant Star Wars et Dark Vador plus particulièrement... Mais l'heure est venue de vous proposer une version totalement massacrée, venue du Japon. Quand les Japonais détruisent l'image de Star Wars pour vendre du thon en boite, ça promet...",
  17. },
  18. }
  19. def _real_extract(self, url):
  20. mobj = re.match(self._VALID_URL, url)
  21. display_id = mobj.group('id')
  22. webpage = self._download_webpage(url, display_id)
  23. title = self._html_search_regex(
  24. r'<span style="font-size: x-large;"><b>(.*?)</b></span>',
  25. webpage, 'title')
  26. description = self._html_search_regex(
  27. r'(?s)<div id="fb-root">(.*?)<script>', webpage, 'description',
  28. fatal=False)
  29. real_url = self._search_regex(
  30. r'\[/postlink\](.*)endofvid', webpage, 'video URL')
  31. video_id = YoutubeIE.extract_id(real_url)
  32. return {
  33. '_type': 'url_transparent',
  34. 'url': real_url,
  35. 'id': video_id,
  36. 'title': title,
  37. 'description': description,
  38. }