2014-11-23 11:41:03 -08:00
# coding: utf-8
2014-10-24 06:09:43 -07:00
from __future__ import unicode_literals
from . common import InfoExtractor
2015-05-07 07:07:11 -07:00
from . . utils import (
2015-05-07 07:09:27 -07:00
int_or_none ,
2015-10-09 16:45:23 -07:00
unescapeHTML ,
2015-05-07 07:07:11 -07:00
)
2014-10-24 06:09:43 -07:00
class BildIE ( InfoExtractor ) :
_VALID_URL = r ' https?://(?:www \ .)?bild \ .de/(?:[^/]+/)+(?P<display_id>[^/]+)-(?P<id> \ d+)(?:,auto=true)? \ .bild \ .html '
IE_DESC = ' Bild.de '
_TEST = {
' url ' : ' http://www.bild.de/video/clip/apple-ipad-air/das-koennen-die-neuen-ipads-38184146.bild.html ' ,
' md5 ' : ' dd495cbd99f2413502a1713a1156ac8a ' ,
' info_dict ' : {
' id ' : ' 38184146 ' ,
' ext ' : ' mp4 ' ,
2015-10-09 16:45:23 -07:00
' title ' : ' Das können die neuen iPads ' ,
2015-05-07 07:20:43 -07:00
' thumbnail ' : ' re:^https?://.* \ .jpg$ ' ,
2014-10-24 06:09:43 -07:00
' duration ' : 196 ,
' description ' : ' Mit dem iPad Air 2 und dem iPad Mini 3 hat Apple zwei neue Tablet-Modelle präsentiert. BILD-Reporter Sven Stein durfte die Geräte bereits testen. ' ,
}
}
def _real_extract ( self , url ) :
video_id = self . _match_id ( url )
2015-10-09 16:45:23 -07:00
video_data = self . _download_json ( url . split ( " .bild.html " ) [ 0 ] + " ,view=json.bild.html " , video_id )
2014-10-24 06:09:43 -07:00
return {
' id ' : video_id ,
2015-10-09 16:45:23 -07:00
' title ' : unescapeHTML ( video_data [ ' title ' ] ) ,
' description ' : unescapeHTML ( video_data . get ( ' description ' ) ) ,
' url ' : video_data [ ' clipList ' ] [ 0 ] [ ' srces ' ] [ 0 ] [ ' src ' ] ,
' thumbnail ' : video_data . get ( ' poster ' ) ,
' duration ' : int_or_none ( video_data . get ( ' durationSec ' ) ) ,
2014-10-24 06:09:43 -07:00
}