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.

79 lines
2.7 KiB

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