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.

52 lines
1.9 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class KarriereVideosIE(InfoExtractor):
  4. _VALID_URL = r'http://(?:www\.)?karrierevideos\.at/berufsvideos/([a-z-]+)/(?P<id>[a-z-]+)'
  5. _TEST = {
  6. 'url': 'http://www.karrierevideos.at/berufsvideos/mittlere-hoehere-schulen/altenpflegerin',
  7. 'info_dict': {
  8. 'id': 'altenpflegerin',
  9. 'ext': 'mp4',
  10. 'title': 'AltenpflegerIn',
  11. 'thumbnail': 're:^http://.*\.png\?v=[0-9]+',
  12. 'description': 'md5:dbadd1259fde2159a9b28667cb664ae2'
  13. },
  14. 'params': {
  15. 'skip_download': 'requires rtmpdump'
  16. }
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. description = self._html_search_regex(
  22. r'<div class="leadtext">\n{0,}?\s{0,}<p>(.*?)</p>',
  23. webpage, 'description')
  24. playlist = self._html_search_regex(r'/config/video/(.*?)\.xml', webpage, 'playlist')
  25. playlist = self._download_xml(
  26. 'http://www.karrierevideos.at/player-playlist.xml.php?p=%s' % playlist,
  27. video_id)
  28. namespace = {
  29. 'jwplayer': 'http://developer.longtailvideo.com/trac/wiki/FlashFormats'
  30. }
  31. item = playlist.find('tracklist/item')
  32. streamer = item.find('jwplayer:streamer', namespace).text
  33. return {
  34. 'id': video_id,
  35. 'title': self._html_search_meta('title', webpage),
  36. 'description': description,
  37. 'thumbnail': 'http://www.karrierevideos.at' + self._html_search_meta('thumbnail', webpage),
  38. 'protocol': 'rtmp',
  39. 'url': streamer.replace('rtmpt', 'http'),
  40. 'play_path': 'mp4:' + item.find('jwplayer:file', namespace).text,
  41. 'tc_url': streamer,
  42. 'ext': 'mp4'
  43. }