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.

56 lines
2.3 KiB

  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. unified_strdate,
  6. )
  7. class NormalbootsIE(InfoExtractor):
  8. _VALID_URL = r'https?://(?:www\.)?normalboots\.com/video/(?P<id>[0-9a-z-]*)/?$'
  9. _TEST = {
  10. 'url': 'http://normalboots.com/video/home-alone-games-jontron/',
  11. 'md5': '8bf6de238915dd501105b44ef5f1e0f6',
  12. 'info_dict': {
  13. 'id': 'home-alone-games-jontron',
  14. 'ext': 'mp4',
  15. 'title': 'Home Alone Games - JonTron - NormalBoots',
  16. '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/',
  17. 'uploader': 'JonTron',
  18. 'upload_date': '20140125',
  19. },
  20. 'params': {
  21. # rtmp download
  22. 'skip_download': True,
  23. },
  24. }
  25. def _real_extract(self, url):
  26. video_id = self._match_id(url)
  27. webpage = self._download_webpage(url, video_id)
  28. video_uploader = self._html_search_regex(
  29. r'Posted\sby\s<a\shref="[A-Za-z0-9/]*">(?P<uploader>[A-Za-z]*)\s</a>',
  30. webpage, 'uploader', fatal=False)
  31. video_upload_date = unified_strdate(self._html_search_regex(
  32. r'<span style="text-transform:uppercase; font-size:inherit;">[A-Za-z]+, (?P<date>.*)</span>',
  33. webpage, 'date', fatal=False))
  34. player_url = self._html_search_regex(
  35. r'<iframe\swidth="[0-9]+"\sheight="[0-9]+"\ssrc="(?P<url>[\S]+)"',
  36. webpage, 'player url')
  37. player_page = self._download_webpage(player_url, video_id)
  38. video_url = self._html_search_regex(
  39. r"file:\s'(?P<file>[^']+\.mp4)'", player_page, 'file')
  40. return {
  41. 'id': video_id,
  42. 'url': video_url,
  43. 'title': self._og_search_title(webpage),
  44. 'description': self._og_search_description(webpage),
  45. 'thumbnail': self._og_search_thumbnail(webpage),
  46. 'uploader': video_uploader,
  47. 'upload_date': video_upload_date,
  48. }