2014-09-27 17:28:01 +00:00
# coding: utf-8
from __future__ import unicode_literals
from . common import InfoExtractor
from . . utils import (
2014-11-04 22:14:16 +00:00
determine_ext ,
2014-10-27 00:33:49 +00:00
int_or_none ,
2014-09-27 17:28:01 +00:00
parse_iso8601 ,
)
class HeiseIE ( InfoExtractor ) :
2014-09-28 08:40:49 +00:00
_VALID_URL = r ''' (?x)
2016-06-07 21:42:56 +00:00
https ? : / / ( ? : www \. ) ? heise \. de / . + ? ( ? P < id > [ 0 - 9 ] + ) \. html ( ? : $ | [ ? #])
2014-09-28 08:40:49 +00:00
'''
2016-06-07 21:42:56 +00:00
_TESTS = [
{
' url ' : (
' http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html '
2014-09-27 17:28:01 +00:00
) ,
2016-06-07 21:42:56 +00:00
' md5 ' : ' ffed432483e922e88545ad9f2f15d30e ' ,
' info_dict ' : {
' id ' : ' 2404147 ' ,
' ext ' : ' mp4 ' ,
' title ' : (
" Podcast: c ' t uplink 3.3 – Owncloud / Tastaturen / Peilsender Smartphone "
) ,
' format_id ' : ' mp4_720p ' ,
' timestamp ' : 1411812600 ,
' upload_date ' : ' 20140927 ' ,
' description ' : ' In uplink-Episode 3.3 geht es darum, wie man sich von Cloud-Anbietern emanzipieren kann, worauf man beim Kauf einer Tastatur achten sollte und was Smartphones über uns verraten. ' ,
' thumbnail ' : r ' re:^https?://.*/gallery/$ ' ,
}
} ,
{
' url ' : (
' http://www.heise.de/ct/artikel/c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2403911.html '
) ,
' md5 ' : ' ffed432483e922e88545ad9f2f15d30e ' ,
' info_dict ' : {
' id ' : ' 2403911 ' ,
' ext ' : ' mp4 ' ,
' title ' : (
" c ' t uplink 3.3: Owncloud, Tastaturen, Peilsender Smartphone "
) ,
' format_id ' : ' mp4_720p ' ,
' timestamp ' : 1411803000 ,
' upload_date ' : ' 20140927 ' ,
' description ' : " In c ' t uplink erklären wir in dieser Woche, wie man mit Owncloud die Kontrolle über die eigenen Daten behält. Darüber hinaus erklären wir, dass zur Wahl der richtigen Tastatur mehr gehört, als man denkt und wie Smartphones uns weiter verraten. " ,
' thumbnail ' : r ' re:^https?://.*/gallery/$ ' ,
}
} ,
{
' url ' : (
' http://www.heise.de/newsticker/meldung/c-t-uplink-Owncloud-Tastaturen-Peilsender-Smartphone-2404251.html?wt_mc=rss.ho.beitrag.atom '
) ,
' md5 ' : ' ffed432483e922e88545ad9f2f15d30e ' ,
' info_dict ' : {
' id ' : ' 2404251 ' ,
' ext ' : ' mp4 ' ,
' title ' : (
" c ' t uplink: Owncloud, Tastaturen, Peilsender Smartphone "
) ,
' format_id ' : ' mp4_720p ' ,
' timestamp ' : 1411811400 ,
' upload_date ' : ' 20140927 ' ,
' description ' : ' In uplink-Episode 3.3 sprechen wir über Owncloud und wie man sich damit von Cloudanbietern emanzipieren kann. Außerdem erklären wir, woran man alles beim Kauf einer Tastatur denken sollte und was Smartphones nun über uns verraten. ' ,
' thumbnail ' : r ' re:^https?://.*/gallery/$ ' ,
}
} ,
{
' url ' : (
' http://www.heise.de/ct/ausgabe/2016-12-Spiele-3214137.html '
) ,
' md5 ' : ' 0616c9297d9c989f9b2a23b483b408c3 ' ,
' info_dict ' : {
' id ' : ' 3214137 ' ,
' ext ' : ' mp4 ' ,
' title ' : (
" c \u2019 t zockt \u201e Glitchspace \u201c , \u201e The Mind ' s Eclipse \u201c und \u201e Windowframe \u201c . "
) ,
' format_id ' : ' mp4_720p ' ,
' timestamp ' : 1464011220 ,
' upload_date ' : ' 20160523 ' ,
' description ' : " Unsere Spiele-Tipps der Woche: Das Puzzle-Adventure Glitchspace, das Jump&Run-Spiel Windowframe und The Mind ' s Eclipse " ,
' thumbnail ' : r ' re:^https?://.*/gallery/$ ' ,
}
} ,
]
2014-09-27 17:28:01 +00:00
def _real_extract ( self , url ) :
2014-09-28 08:40:49 +00:00
video_id = self . _match_id ( url )
webpage = self . _download_webpage ( url , video_id )
2014-10-27 00:33:49 +00:00
container_id = self . _search_regex (
2016-06-07 21:42:56 +00:00
r ' <div class= " videoplayerjw " [^>]*data-container= " ([0-9]+) " ' ,
2014-10-27 00:33:49 +00:00
webpage , ' container ID ' )
sequenz_id = self . _search_regex (
2016-06-07 21:42:56 +00:00
r ' <div class= " videoplayerjw " [^>]*data-sequenz= " ([0-9]+) " ' ,
2014-10-27 00:33:49 +00:00
webpage , ' sequenz ID ' )
data_url = ' http://www.heise.de/videout/feed?container= %s &sequenz= %s ' % ( container_id , sequenz_id )
doc = self . _download_xml ( data_url , video_id )
2014-09-27 17:28:01 +00:00
info = {
2014-09-28 08:40:49 +00:00
' id ' : video_id ,
2016-06-07 21:42:56 +00:00
' thumbnail ' : doc . find ( ' .// { http://rss.jwpcdn.com/}image ' ) . text ,
2014-11-04 22:14:16 +00:00
' timestamp ' : parse_iso8601 (
2016-06-07 21:42:56 +00:00
self . _html_search_meta ( ' date ' , webpage ) )
2014-09-27 17:28:01 +00:00
}
2016-06-07 21:42:56 +00:00
title = self . _html_search_meta ( ' fulltitle ' , webpage , default = None )
if not title or title == " c ' t " :
title = self . _search_regex (
r ' <div class= " videoplayerjw " [^>]*data-title= " ([^ " ]+) " ' ,
webpage , ' video title ' )
info [ ' title ' ] = title
desc = self . _og_search_description ( webpage , default = None )
if not desc :
desc = self . _html_search_meta ( ' description ' , webpage )
info [ ' description ' ] = desc
2014-09-27 17:28:01 +00:00
formats = [ ]
2014-10-27 00:33:49 +00:00
for source_node in doc . findall ( ' .// { http://rss.jwpcdn.com/}source ' ) :
label = source_node . attrib [ ' label ' ]
height = int_or_none ( self . _search_regex (
r ' ^(.*?_)?([0-9]+)p$ ' , label , ' height ' , default = None ) )
2014-11-04 22:14:16 +00:00
video_url = source_node . attrib [ ' file ' ]
ext = determine_ext ( video_url , ' ' )
2014-10-27 00:33:49 +00:00
formats . append ( {
2014-11-04 22:14:16 +00:00
' url ' : video_url ,
2014-10-27 00:33:49 +00:00
' format_note ' : label ,
2014-11-04 22:14:16 +00:00
' format_id ' : ' %s _ %s ' % ( ext , label ) ,
2014-10-27 00:33:49 +00:00
' height ' : height ,
} )
2014-09-27 17:28:01 +00:00
self . _sort_formats ( formats )
info [ ' formats ' ] = formats
return info