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.

51 lines
2.3 KiB

  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import (
  6. unified_strdate,
  7. )
  8. class NormalbootsIE(InfoExtractor):
  9. _VALID_URL = r'http://(?:www\.)?normalboots\.com/video/(?P<videoid>[0-9a-z-]*)/?$'
  10. _TEST = {
  11. 'url': 'http://normalboots.com/video/home-alone-games-jontron/',
  12. 'md5': '8bf6de238915dd501105b44ef5f1e0f6',
  13. 'info_dict': {
  14. 'id': 'home-alone-games-jontron',
  15. 'ext': 'mp4',
  16. 'title': 'Home Alone Games - JonTron - NormalBoots',
  17. 'description': 'Jon is late for Christmas. Typical. Thanks to: Paul Ritchey for Co-Writing/Filming: http://www.youtube.com/user/ContinueShow Michael Azzi for Christmas Intro Animation: http://michafrar.tumblr.com/ Jerrod Waters for Christmas Intro Music: http://www.youtube.com/user/xXJerryTerryXx Casey Ormond for ‘Tense Battle Theme’:\xa0http://www.youtube.com/Kiamet/',
  18. 'uploader': 'JonTron',
  19. 'upload_date': '20140125',
  20. }
  21. }
  22. def _real_extract(self, url):
  23. mobj = re.match(self._VALID_URL, url)
  24. video_id = mobj.group('videoid')
  25. webpage = self._download_webpage(url, video_id)
  26. video_uploader = self._html_search_regex(r'Posted\sby\s<a\shref="[A-Za-z0-9/]*">(?P<uploader>[A-Za-z]*)\s</a>',
  27. webpage, 'uploader')
  28. raw_upload_date = self._html_search_regex('<span style="text-transform:uppercase; font-size:inherit;">[A-Za-z]+, (?P<date>.*)</span>',
  29. webpage, 'date')
  30. video_upload_date = unified_strdate(raw_upload_date)
  31. player_url = self._html_search_regex(r'<iframe\swidth="[0-9]+"\sheight="[0-9]+"\ssrc="(?P<url>[\S]+)"', webpage, 'url')
  32. player_page = self._download_webpage(player_url, video_id)
  33. video_url = self._html_search_regex(r"file:\s'(?P<file>[^']+\.mp4)'", player_page, 'file')
  34. return {
  35. 'id': video_id,
  36. 'url': video_url,
  37. 'title': self._og_search_title(webpage),
  38. 'description': self._og_search_description(webpage),
  39. 'thumbnail': self._og_search_thumbnail(webpage),
  40. 'uploader': video_uploader,
  41. 'upload_date': video_upload_date,
  42. }