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.

80 lines
2.7 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. from __future__ import unicode_literals
  2. import re
  3. import random
  4. import json
  5. from .common import InfoExtractor
  6. from ..utils import (
  7. determine_ext,
  8. get_element_by_id,
  9. clean_html,
  10. )
  11. class FKTVIE(InfoExtractor):
  12. IE_NAME = 'fernsehkritik.tv'
  13. _VALID_URL = r'http://(?:www\.)?fernsehkritik\.tv/folge-(?P<ep>[0-9]+)(?:/.*)?'
  14. _TEST = {
  15. 'url': 'http://fernsehkritik.tv/folge-1',
  16. 'info_dict': {
  17. 'id': '00011',
  18. 'ext': 'flv',
  19. 'title': 'Folge 1 vom 10. April 2007',
  20. 'description': 'md5:fb4818139c7cfe6907d4b83412a6864f',
  21. },
  22. }
  23. def _real_extract(self, url):
  24. mobj = re.match(self._VALID_URL, url)
  25. episode = int(mobj.group('ep'))
  26. server = random.randint(2, 4)
  27. video_thumbnail = 'http://fernsehkritik.tv/images/magazin/folge%d.jpg' % episode
  28. start_webpage = self._download_webpage('http://fernsehkritik.tv/folge-%d/Start' % episode,
  29. episode)
  30. playlist = self._search_regex(r'playlist = (\[.*?\]);', start_webpage,
  31. 'playlist', flags=re.DOTALL)
  32. files = json.loads(re.sub('{[^{}]*?}', '{}', playlist))
  33. # TODO: return a single multipart video
  34. videos = []
  35. for i, _ in enumerate(files, 1):
  36. video_id = '%04d%d' % (episode, i)
  37. video_url = 'http://dl%d.fernsehkritik.tv/fernsehkritik%d%s.flv' % (server, episode, '' if i == 1 else '-%d' % i)
  38. videos.append({
  39. 'id': video_id,
  40. 'url': video_url,
  41. 'title': clean_html(get_element_by_id('eptitle', start_webpage)),
  42. 'description': clean_html(get_element_by_id('contentlist', start_webpage)),
  43. 'thumbnail': video_thumbnail
  44. })
  45. return videos
  46. class FKTVPosteckeIE(InfoExtractor):
  47. IE_NAME = 'fernsehkritik.tv:postecke'
  48. _VALID_URL = r'http://(?:www\.)?fernsehkritik\.tv/inline-video/postecke\.php\?(.*&)?ep=(?P<ep>[0-9]+)(&|$)'
  49. _TEST = {
  50. 'url': 'http://fernsehkritik.tv/inline-video/postecke.php?iframe=true&width=625&height=440&ep=120',
  51. 'md5': '262f0adbac80317412f7e57b4808e5c4',
  52. 'info_dict': {
  53. 'id': '0120',
  54. 'ext': 'flv',
  55. 'title': 'Postecke 120',
  56. }
  57. }
  58. def _real_extract(self, url):
  59. mobj = re.match(self._VALID_URL, url)
  60. episode = int(mobj.group('ep'))
  61. server = random.randint(2, 4)
  62. video_id = '%04d' % episode
  63. video_url = 'http://dl%d.fernsehkritik.tv/postecke/postecke%d.flv' % (server, episode)
  64. video_title = 'Postecke %d' % episode
  65. return {
  66. 'id': video_id,
  67. 'url': video_url,
  68. 'title': video_title,
  69. }