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.

72 lines
2.6 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import (
  6. int_or_none,
  7. parse_duration,
  8. str_to_int,
  9. unified_strdate,
  10. )
  11. class GameStarIE(InfoExtractor):
  12. _VALID_URL = r'http://www\.gamestar\.de/videos/.*,(?P<id>[0-9]+)\.html'
  13. _TEST = {
  14. 'url': 'http://www.gamestar.de/videos/trailer,3/hobbit-3-die-schlacht-der-fuenf-heere,76110.html',
  15. 'md5': '96974ecbb7fd8d0d20fca5a00810cea7',
  16. 'info_dict': {
  17. 'id': '76110',
  18. 'ext': 'mp4',
  19. 'title': 'Hobbit 3: Die Schlacht der Fünf Heere - Teaser-Trailer zum dritten Teil',
  20. 'description': 'Der Teaser-Trailer zu Hobbit 3: Die Schlacht der Fünf Heere zeigt einige Szenen aus dem dritten Teil der Saga und kündigt den vollständigen Trailer an.',
  21. 'thumbnail': 'http://images.gamestar.de/images/idgwpgsgp/bdb/2494525/600x.jpg',
  22. 'upload_date': '20140728',
  23. 'duration': 17
  24. }
  25. }
  26. def _real_extract(self, url):
  27. video_id = self._match_id(url)
  28. webpage = self._download_webpage(url, video_id)
  29. og_title = self._og_search_title(webpage)
  30. title = re.sub(r'\s*- Video (bei|-) GameStar\.de$', '', og_title)
  31. url = 'http://gamestar.de/_misc/videos/portal/getVideoUrl.cfm?premium=0&videoId=' + video_id
  32. description = self._og_search_description(webpage).strip()
  33. thumbnail = self._proto_relative_url(
  34. self._og_search_thumbnail(webpage), scheme='http:')
  35. upload_date = unified_strdate(self._html_search_regex(
  36. r'<span style="float:left;font-size:11px;">Datum: ([0-9]+\.[0-9]+\.[0-9]+)&nbsp;&nbsp;',
  37. webpage, 'upload_date', fatal=False))
  38. duration = parse_duration(self._html_search_regex(
  39. r'&nbsp;&nbsp;Länge: ([0-9]+:[0-9]+)</span>', webpage, 'duration',
  40. fatal=False))
  41. view_count = str_to_int(self._html_search_regex(
  42. r'&nbsp;&nbsp;Zuschauer: ([0-9\.]+)&nbsp;&nbsp;', webpage,
  43. 'view_count', fatal=False))
  44. comment_count = int_or_none(self._html_search_regex(
  45. r'>Kommentieren \(([0-9]+)\)</a>', webpage, 'comment_count',
  46. fatal=False))
  47. return {
  48. 'id': video_id,
  49. 'title': title,
  50. 'url': url,
  51. 'ext': 'mp4',
  52. 'thumbnail': thumbnail,
  53. 'description': description,
  54. 'upload_date': upload_date,
  55. 'duration': duration,
  56. 'view_count': view_count,
  57. 'comment_count': comment_count
  58. }