Kom uden om DR's flash-afspiller
Jeg ser nogen gange Bonderøven på DR1. Men selv om programmerne er tilgængelige via flash-afspilleren, så er DR er langsomme til at lægge programmerne ud til download. Flash-afspilleren er ret irriterende, da man for eksempel ikke kan putte den i fuldscreen, og så samtidigt klikke rundt på sin sekundære skærm.
Så siden flash-afspilleren må hente videoen et sted fra, så må jeg da også kunne hente den derfra, og så afspille den fra den downloadede fil.
Første trin er at bruge Chromium's developer tools til at "inspecte" flashplayeren på http://www.dr.dk/dr1/bonderoeven . Den har kildekoden
Her set det ud til at indholdet af "flashVars" er det interessante. Et gæt er, at det er urlencoded, så efter det er kørt igennem http://meyerweb.com/eric/tools/dencoder/ bliver det til
Det meste er det er referencer til DR's kanaler (DR1, DR2, etc), som er irrelevante. Efetr at have formatteret og smidt de åbenlyst irrelevante ting ud er der følgende tilbage:
I sektionen "urls" gætter jeg mig frem til at {slug} er et ID for serien (Bonderøven), og {videoId} er et ID for det enkelte afsnit.
Det viser sig at http://www.dr.dk/nu/api/programseries giver en liste over alle DR's programserier. Bonderøvens indgang i den liste er
Så vi gætter på at 18431 er et eksempel på et videoId. Og http://www.dr.dk/nu/api/videos/18431/images/1000x1000.jpg giver da også et pænt billede for det afsnit. Ved at bruge http://www.dr.dk/nu/api/videos/18431 får vi information om afsnittet:
Her er videoResourceUrl nok hvor selve videoen er. http://www.dr.dk/handlers/GetResource.ashx?id=983628 giver (efter lidt formattering)
Hvor der tydeligvis er en indgang for hver kvalitet. DVS at URLen for den højeste kvalitet er rtmp://vod.dr.dk/cms/mp4:CMS/Resources/dr.dk/NETTV/DR1/2011/09/18a5c2f8-8802-4de6-9a9d-6b337b95e1ad/Bonderoeven--5-10---7--saeson-_32f7289ed4f9472c805711dfd91fbf90.mp4?ID=983628
hvor delen efter ":" er en playpath. Den kan downloades med Linux-programmet rtmpdump med kommandoen
Tak til marlar i tråden http://www.linuxin.dk/node/17903 for at finde ud af playpath-delen!
Vi mangler stadig at finde links til de gamle afsnit, og til det skal vi gætte {slug} i URLerne. For at finde {slug} for Bonderøven kigger jeg på programseriernes links nederst på siden http://www.dr.dk/nu , og kan se at de er af formen http://www.dr.dk/nu/player/#/bonderoeven/18431 eller http://www.dr.dk/nu/player/#/bonderoeven-retro/13380 . Så siden 18431 var et videoId, gætter jeg på at "bonderoeven" er {slug}. Og ganske rigtigt, så giver http://www.dr.dk/nu/api/programseries/bonderoeven/images/1000x1000.jpg og http://www.dr.dk/nu/api/programseries/bonderoeven/videos et logo samt en liste over episoder med tilhørende downloadlinks.
Så siden flash-afspilleren må hente videoen et sted fra, så må jeg da også kunne hente den derfra, og så afspille den fra den downloadede fil.
Første trin er at bruge Chromium's developer tools til at "inspecte" flashplayeren på http://www.dr.dk/dr1/bonderoeven . Den har kildekoden
<object id="nettvPlayer" height="349px" width="620px" type="application/x-shockwave-flash" data="/nu/assets/swf/NetTVPlayer_10.swf">
<param name="quality" value="high">
<param name="allowScriptAccess" value="always">
<param name="wMode" value="transparent">
<param name="swLiveConnect" value="true">
<param name="bgcolor" value="#000000">
<param name="AllowScriptAccess" value="sameDomain">
<param name="AllowFullScreen" value="true">
<param name="flashVars" value="data=%7B%22swf%22%3A%22%2Fnu%2Fassets%2Fswf%2FNetTVPlayer_10.swf%22%2C%22height%22%3A%22349px%22%2C%22width%22%3A%22620px%22%2C%22version%22%3A%229.1.0%22%2C%22smoothing%22%3Afalse%2C%22loopPlaylist%22%3Afalse%2C%22autoplay%22%3Atrue%2C%22wmode%22%3A%22transparent%22%2C%22bgcolor%22%3A%22%23000000%22%2C%22geoLocationServiceUrl%22%3A%22http%3A%2F%2Fwww.dr.dk%2Ftjenester%2Fgeolocation%2FGeoLocation.asmx%2FGet%22%2C%22popup%22%3Afalse%2C%22color%22%3A%22%22%2C%22content%22%3A%22od%2Fbonderoeven%2F%22%2C%22live%22%3Afalse%2C%22showChannels%22%3Atrue%2C%22urls%22%3A%7B%22popupUrl%22%3A%22%2Fnu%2Fpopup%2F%22%2C%22seriesImageUrl%22%3A%22%2Fnu%2Fapi%2Fprogramseries%2F%7Bslug%7D%2Fimages%2F%7Bwidth%7Dx%7Bheight%7D.jpg%22%2C%22episodeImageUrl%22%3A%22%2Fnu%2Fapi%2Fvideos%2F%7Bid%7D%2Fimages%2F%7Bwidth%7Dx%7Bheight%7D.jpg%22%2C%22episodesUrl%22%3A%22%2Fnu%2Fapi%2Fprogramseries%2F%7Bslug%7D%2Fvideos%22%2C%22videoUrl%22%3A%22%2Fnu%2Fapi%2Fvideos%2F%7BvideoId%7D%22%2C%22registerView%22%3A%22%2Fnu%2Fapi%2FVideoView%2F%7BvideoId%7D%2F%7BuserId%7D%2F%7BrtmpVideoHost%7D%22%2C%22registerFedoraView%22%3A%22http%3A%2F%2F77.66.32.234%2Fcammpdrnu%2Fmobilwebapp%3Fxslt%3DcopyXml%26service%3DshowClipInfo%26externalId%3D%7BvideoId%7D%26loginName%3D%7BuserId%7D%22%2C%22registerChapterView%22%3A%22%22%2C%22seriesUrl%22%3A%22%2Fnu%2Fapi%2Fprogramseries%22%2C%22flashStatisticUrl%22%3A%22%22%2C%22reportErrorUrl%22%3A%22%2Fnu%2Ffeedback%2F%22%2C%22geoFilterUrl%22%3A%22%2Fnu%2Fgeofilter%2F%22%2C%22liveDeeplink%22%3A%22http%3A%2F%2Fwww.dr.dk%2Fnu%2Flive%2Fse%22%2C%22onDemandDeeplink%22%3A%22http%3A%2F%2Fwww.dr.dk%2Fnu%2Fse%22%2C%22chapterImageUrl%22%3A%22%2Fnu%2Fapi%2Fchapters%2F%7BchapterId%7D%2Fimages%2F%7Bwidth%7Dx%7Bheight%7D.jpg%22%7D%2C%22modules%22%3A%5B%7B%22className%22%3A%22Gemius%22%2C%22parameters%22%3A%7B%22encoding%22%3A%22utf-8%22%2C%22identifier%22%3A%22p9AwR.N.S86s_NjaJKdww7b.fdp8ky90ZnrKpgLHOUn.s7%22%2C%22hitCollector%22%3A%22http%3A%2F%2Fsdk.hit.gemius.pl%22%2C%22playerId%22%3A%22UPlayer%22%7D%7D%2C%7B%22className%22%3A%22JavaScript%22%2C%22parameters%22%3A%7B%7D%7D%5D%2C%22liveStreams%22%3A%5B%7B%22channelName%22%3A%22DR1%22%2C%22gemius_customPackage%22%3A%5B%7B%22name%22%3A%22CHANNEL%22%2C%22value%22%3A%22LIVE%22%7D%2C%7B%22name%22%3A%22PROGRAMME%22%2C%22value%22%3A%22DR1%22%7D%2C%7B%22name%22%3A%22AUTOSTART%22%2C%22value%22%3A%22YES%22%7D%5D%2C%22gemius_materialId%22%3A%22019_LIVE-DR1%26DR1%22%2C%22gemius_live%22%3Atrue%2C%22mediaFiles%22%3A%5B%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr01astream3%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr01bstream3%22%2C%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Ffv2011stream3%22%2C%22rtmp%3A%2F%2Ffl0.c41003.cdn.qbrick.com%2F41003%2Ffv2011stream3%22%5D%2C%22kbps%22%3A1000%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr01astream2%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr01bstream2%22%2C%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Ffv2011stream2%22%2C%22rtmp%3A%2F%2Ffl0.c41003.cdn.qbrick.com%2F41003%2Ffv2011stream2%22%5D%2C%22kbps%22%3A500%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr01astream1%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr01bstream1%22%2C%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Ffv2011stream1%22%2C%22rtmp%3A%2F%2Ffl0.c41003.cdn.qbrick.com%2F41003%2Ffv2011stream1%22%5D%2C%22kbps%22%3A250%7D%5D%7D%2C%7B%22channelName%22%3A%22DR2%22%2C%22gemius_customPackage%22%3A%5B%7B%22name%22%3A%22CHANNEL%22%2C%22value%22%3A%22LIVE%22%7D%2C%7B%22name%22%3A%22PROGRAMME%22%2C%22value%22%3A%22DR2%22%7D%2C%7B%22name%22%3A%22AUTOSTART%22%2C%22value%22%3A%22YES%22%7D%5D%2C%22gemius_materialId%22%3A%22019_LIVE-DR2%26DR2%22%2C%22gemius_live%22%3Atrue%2C%22mediaFiles%22%3A%5B%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr02astream3%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr02bstream3%22%5D%2C%22kbps%22%3A1000%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr02astream2%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr02bstream2%22%5D%2C%22kbps%22%3A500%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr02astream1%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr02bstream1%22%5D%2C%22kbps%22%3A250%7D%5D%7D%2C%7B%22channelName%22%3A%22DR%20K%22%2C%22gemius_customPackage%22%3A%5B%7B%22name%22%3A%22CHANNEL%22%2C%22value%22%3A%22LIVE%22%7D%2C%7B%22name%22%3A%22PROGRAMME%22%2C%22value%22%3A%22DR%20K%22%7D%2C%7B%22name%22%3A%22AUTOSTART%22%2C%22value%22%3A%22YES%22%7D%5D%2C%22gemius_materialId%22%3A%22019_LIVE-DR%20K%26DR%20K%22%2C%22gemius_live%22%3Atrue%2C%22mediaFiles%22%3A%5B%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr04astream3%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr04bstream3%22%5D%2C%22kbps%22%3A1000%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr04astream2%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr04bstream2%22%5D%2C%22kbps%22%3A500%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr04astream1%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr04bstream1%22%5D%2C%22kbps%22%3A250%7D%5D%7D%2C%7B%22channelName%22%3A%22DR%20Ramasjang%22%2C%22gemius_customPackage%22%3A%5B%7B%22name%22%3A%22CHANNEL%22%2C%22value%22%3A%22LIVE%22%7D%2C%7B%22name%22%3A%22PROGRAMME%22%2C%22value%22%3A%22DR%20Ramasjang%22%7D%2C%7B%22name%22%3A%22AUTOSTART%22%2C%22value%22%3A%22YES%22%7D%5D%2C%22gemius_materialId%22%3A%22019_LIVE-DR%20Ramasjang%26DR%20Ramasjang%22%2C%22gemius_live%22%3Atrue%2C%22mediaFiles%22%3A%5B%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr05astream3%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr05bstream3%22%5D%2C%22kbps%22%3A1000%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr05astream2%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr05bstream2%22%5D%2C%22kbps%22%3A500%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr05astream1%22%2C%22rtmp%3A%2F%2Frtmplive.dr.dk%2Flive%2Flivedr05bstream1%22%5D%2C%22kbps%22%3A250%7D%5D%7D%2C%7B%22channelName%22%3A%22DR%20Update%22%2C%22gemius_customPackage%22%3A%5B%7B%22name%22%3A%22CHANNEL%22%2C%22value%22%3A%22LIVE%22%7D%2C%7B%22name%22%3A%22PROGRAMME%22%2C%22value%22%3A%22DR%20Update%22%7D%2C%7B%22name%22%3A%22AUTOSTART%22%2C%22value%22%3A%22YES%22%7D%5D%2C%22gemius_materialId%22%3A%22019_LIVE-DR%20Update%26DR%20Update%22%2C%22gemius_live%22%3Atrue%2C%22mediaFiles%22%3A%5B%7B%22mediaFile%22%3A%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr03astream3%22%2C%22kbps%22%3A1000%7D%2C%7B%22mediaFile%22%3A%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr03astream2%22%2C%22kbps%22%3A500%7D%2C%7B%22mediaFile%22%3A%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr03astream1%22%2C%22kbps%22%3A250%7D%5D%7D%2C%7B%22channelName%22%3A%22DR%20HD%22%2C%22gemius_customPackage%22%3A%5B%7B%22name%22%3A%22CHANNEL%22%2C%22value%22%3A%22LIVE%22%7D%2C%7B%22name%22%3A%22PROGRAMME%22%2C%22value%22%3A%22DR%20HD%22%7D%2C%7B%22name%22%3A%22AUTOSTART%22%2C%22value%22%3A%22YES%22%7D%5D%2C%22gemius_materialId%22%3A%22019_LIVE-DR%20HD%26DR%20HD%22%2C%22gemius_live%22%3Atrue%2C%22mediaFiles%22%3A%5B%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr06astream3%22%2C%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr06bstream3%22%5D%2C%22kbps%22%3A1700%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr06astream2%22%2C%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr06bstream2%22%5D%2C%22kbps%22%3A1000%7D%2C%7B%22mediaFile%22%3A%5B%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr06astream1%22%2C%22rtmp%3A%2F%2Flivetv.gss.dr.dk%2Flive%2Flivedr06bstream1%22%5D%2C%22kbps%22%3A500%7D%5D%7D%5D%7D&onLoad=Swiff.CallBacks.Swiff_1316964073832.onLoad&onData=Swiff.CallBacks.Swiff_1316964073832.onData&onSkip=Swiff.CallBacks.Swiff_1316964073832.onSkip&onStateChange=Swiff.CallBacks.Swiff_1316964073832.onStateChange&onShare=Swiff.CallBacks.Swiff_1316964073832.onShare&onPopup=Swiff.CallBacks.Swiff_1316964073832.onPopup&onRequestNowNext=Swiff.CallBacks.Swiff_1316964073832.onRequestNowNext&onContentPathChange=Swiff.CallBacks.Swiff_1316964073832.onContentPathChange"></object>
Her set det ud til at indholdet af "flashVars" er det interessante. Et gæt er, at det er urlencoded, så efter det er kørt igennem http://meyerweb.com/eric/tools/dencoder/ bliver det til
data={"swf":"/nu/assets/swf/NetTVPlayer_10.swf","height":"349px","width":"620px","version":"9.1.0","smoothing":false,"loopPlaylist":false,"autoplay":true,"wmode":"transparent","bgcolor":"#000000","geoLocationServiceUrl":"http://www.dr.dk/tjenester/geolocation/GeoLocation.asmx/Get","popup":false,"color":"","content":"od/bonderoeven/","live":false,"showChannels":true,"urls":{"popupUrl":"/nu/popup/","seriesImageUrl":"/nu/api/programseries/{slug}/images/{width}x{height}.jpg","episodeImageUrl":"/nu/api/videos/{id}/images/{width}x{height}.jpg","episodesUrl":"/nu/api/programseries/{slug}/videos","videoUrl":"/nu/api/videos/{videoId}","registerView":"/nu/api/VideoView/{videoId}/{userId}/{rtmpVideoHost}","registerFedoraView":"http://77.66.32.234/cammpdrnu/mobilwebapp?xslt=copyXml&service=showClipInfo&externalId={videoId}&loginName={userId}","registerChapterView":"","seriesUrl":"/nu/api/programseries","flashStatisticUrl":"","reportErrorUrl":"/nu/feedback/","geoFilterUrl":"/nu/geofilter/","liveDeeplink":"http://www.dr.dk/nu/live/se","onDemandDeeplink":"http://www.dr.dk/nu/se","chapterImageUrl":"/nu/api/chapters/{chapterId}/images/{width}x{height}.jpg"},"modules":[{"className":"Gemius","parameters":{"encoding":"utf-8","identifier":"p9AwR.N.S86s_NjaJKdww7b.fdp8ky90ZnrKpgLHOUn.s7","hitCollector":"http://sdk.hit.gemius.pl","playerId":"UPlayer"}},{"className":"JavaScript","parameters":{}}],"liveStreams":[{"channelName":"DR1","gemius_customPackage":[{"name":"CHANNEL","value":"LIVE"},{"name":"PROGRAMME","value":"DR1"},{"name":"AUTOSTART","value":"YES"}],"gemius_materialId":"019_LIVE-DR1&DR1","gemius_live":true,"mediaFiles":[{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr01astream3","rtmp://rtmplive.dr.dk/live/livedr01bstream3","rtmp://livetv.gss.dr.dk/live/fv2011stream3","rtmp://fl0.c41003.cdn.qbrick.com/41003/fv2011stream3"],"kbps":1000},{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr01astream2","rtmp://rtmplive.dr.dk/live/livedr01bstream2","rtmp://livetv.gss.dr.dk/live/fv2011stream2","rtmp://fl0.c41003.cdn.qbrick.com/41003/fv2011stream2"],"kbps":500},{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr01astream1","rtmp://rtmplive.dr.dk/live/livedr01bstream1","rtmp://livetv.gss.dr.dk/live/fv2011stream1","rtmp://fl0.c41003.cdn.qbrick.com/41003/fv2011stream1"],"kbps":250}]},{"channelName":"DR2","gemius_customPackage":[{"name":"CHANNEL","value":"LIVE"},{"name":"PROGRAMME","value":"DR2"},{"name":"AUTOSTART","value":"YES"}],"gemius_materialId":"019_LIVE-DR2&DR2","gemius_live":true,"mediaFiles":[{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr02astream3","rtmp://rtmplive.dr.dk/live/livedr02bstream3"],"kbps":1000},{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr02astream2","rtmp://rtmplive.dr.dk/live/livedr02bstream2"],"kbps":500},{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr02astream1","rtmp://rtmplive.dr.dk/live/livedr02bstream1"],"kbps":250}]},{"channelName":"DR K","gemius_customPackage":[{"name":"CHANNEL","value":"LIVE"},{"name":"PROGRAMME","value":"DR K"},{"name":"AUTOSTART","value":"YES"}],"gemius_materialId":"019_LIVE-DR K&DR K","gemius_live":true,"mediaFiles":[{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr04astream3","rtmp://rtmplive.dr.dk/live/livedr04bstream3"],"kbps":1000},{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr04astream2","rtmp://rtmplive.dr.dk/live/livedr04bstream2"],"kbps":500},{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr04astream1","rtmp://rtmplive.dr.dk/live/livedr04bstream1"],"kbps":250}]},{"channelName":"DR Ramasjang","gemius_customPackage":[{"name":"CHANNEL","value":"LIVE"},{"name":"PROGRAMME","value":"DR Ramasjang"},{"name":"AUTOSTART","value":"YES"}],"gemius_materialId":"019_LIVE-DR Ramasjang&DR Ramasjang","gemius_live":true,"mediaFiles":[{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr05astream3","rtmp://rtmplive.dr.dk/live/livedr05bstream3"],"kbps":1000},{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr05astream2","rtmp://rtmplive.dr.dk/live/livedr05bstream2"],"kbps":500},{"mediaFile":["rtmp://rtmplive.dr.dk/live/livedr05astream1","rtmp://rtmplive.dr.dk/live/livedr05bstream1"],"kbps":250}]},{"channelName":"DR Update","gemius_customPackage":[{"name":"CHANNEL","value":"LIVE"},{"name":"PROGRAMME","value":"DR Update"},{"name":"AUTOSTART","value":"YES"}],"gemius_materialId":"019_LIVE-DR Update&DR Update","gemius_live":true,"mediaFiles":[{"mediaFile":"rtmp://livetv.gss.dr.dk/live/livedr03astream3","kbps":1000},{"mediaFile":"rtmp://livetv.gss.dr.dk/live/livedr03astream2","kbps":500},{"mediaFile":"rtmp://livetv.gss.dr.dk/live/livedr03astream1","kbps":250}]},{"channelName":"DR HD","gemius_customPackage":[{"name":"CHANNEL","value":"LIVE"},{"name":"PROGRAMME","value":"DR HD"},{"name":"AUTOSTART","value":"YES"}],"gemius_materialId":"019_LIVE-DR HD&DR HD","gemius_live":true,"mediaFiles":[{"mediaFile":["rtmp://livetv.gss.dr.dk/live/livedr06astream3","rtmp://livetv.gss.dr.dk/live/livedr06bstream3"],"kbps":1700},{"mediaFile":["rtmp://livetv.gss.dr.dk/live/livedr06astream2","rtmp://livetv.gss.dr.dk/live/livedr06bstream2"],"kbps":1000},{"mediaFile":["rtmp://livetv.gss.dr.dk/live/livedr06astream1","rtmp://livetv.gss.dr.dk/live/livedr06bstream1"],"kbps":500}]}]}&onLoad=Swiff.CallBacks.Swiff_1316964073832.onLoad&onData=Swiff.CallBacks.Swiff_1316964073832.onData&onSkip=Swiff.CallBacks.Swiff_1316964073832.onSkip&onStateChange=Swiff.CallBacks.Swiff_1316964073832.onStateChange&onShare=Swiff.CallBacks.Swiff_1316964073832.onShare&onPopup=Swiff.CallBacks.Swiff_1316964073832.onPopup&onRequestNowNext=Swiff.CallBacks.Swiff_1316964073832.onRequestNowNext&onContentPathChange=Swiff.CallBacks.Swiff_1316964073832.onContentPathChange
Det meste er det er referencer til DR's kanaler (DR1, DR2, etc), som er irrelevante. Efetr at have formatteret og smidt de åbenlyst irrelevante ting ud er der følgende tilbage:
data = {
"content":"od/bonderoeven/",
"urls":{
"seriesImageUrl":"/nu/api/programseries/{slug}/images/{width}x{height}.jpg",
"episodeImageUrl":"/nu/api/videos/{id}/images/{width}x{height}.jpg",
"episodesUrl":"/nu/api/programseries/{slug}/videos",
"videoUrl":"/nu/api/videos/{videoId}",
"seriesUrl":"/nu/api/programseries",
},
"modules":
[
{
"className":"Gemius",
"parameters":{
"encoding":"utf-8",
"identifier":"p9AwR.N.S86s_NjaJKdww7b.fdp8ky90ZnrKpgLHOUn.s7",
"hitCollector":"http://sdk.hit.gemius.pl",
"playerId":"UPlayer"
}
}
]
}
I sektionen "urls" gætter jeg mig frem til at {slug} er et ID for serien (Bonderøven), og {videoId} er et ID for det enkelte afsnit.
Det viser sig at http://www.dr.dk/nu/api/programseries giver en liste over alle DR's programserier. Bonderøvens indgang i den liste er
{
"slug": "bonderoeven",
"title": "Bonderøven",
"description": "Frank er lidt spændt, for føllet Manfred er til hingstekåring, hvor han skal bedømmes af tyske dommere, sammen med andre Schleswiger-føl. Og så er det dagen, hvor Frank skal høste med selvbinder, men først laver han et nyt selvbindersejl af en rulle lærred han købte, da han var 18 år. Mirabellerne er modne, så hele familien drager ud med spand for at plukke.",
"shortName": null,
"newestVideoId": 18431,
"newestVideoPublishTime": "\/Date(1316543400000+0200)\/",
"videoCount": 32,
"labels": [
"livsstil"
]
},
Så vi gætter på at 18431 er et eksempel på et videoId. Og http://www.dr.dk/nu/api/videos/18431/images/1000x1000.jpg giver da også et pænt billede for det afsnit. Ved at bruge http://www.dr.dk/nu/api/videos/18431 får vi information om afsnittet:
{
"id": 18431,
"description": "Frank er lidt spændt, for føllet Manfred er til hingstekåring, hvor han skal bedømmes af tyske dommere, sammen med andre Schleswiger-føl. Og så er det dagen, hvor Frank skal høste med selvbinder, men først laver han et nyt selvbindersejl af en rulle lærred han købte, da han var 18 år. Mirabellerne er modne, så hele familien drager ud med spand for at plukke.",
"programSerieSlug": "bonderoeven",
"title": "Bonderøven (5:10)",
"duration": "00:27:14",
"broadcastTime": "\/Date(1317148200000+0200)\/",
"expireTime": "\/Date(32503676400000+0100)\/",
"publishTime": "\/Date(-62135596800000+0100)\/",
"expired": false,
"broadcastChannel": "DR1",
"videoManifestUrl": "http://www.dr.dk/Forms/Published/PlaylistGen.aspx?qid=2350582&OnlyWritePath=True",
"videoResourceUrl": "http://www.dr.dk/handlers/GetResource.ashx?id=983628",
"premiere": true,
"rtmpVideoHost": null,
"formattedExpireTime": "1. jan. 3000",
"formattedBroadcastTime": "27. sep. 2011",
"formattedBroadcastTimeForTVSchedule": "tir. d. 27. sep",
"formattedBroadcastHourForTVSchedule": "Kl. 20:30",
"chapters": []
}
Her er videoResourceUrl nok hvor selve videoen er. http://www.dr.dk/handlers/GetResource.ashx?id=983628 giver (efter lidt formattering)
{
"resourceId":983628,
"name":"Bonderøven (5:10) 7. sæson, efterår 2011 ",
"mediaType":"Video",
"restrictedToDenmark":false,
"downloadable":false,
"geofilterId":0,
"publish":"2011-09-19T14:46:32",
"expire":"3000-01-01T00:00:00",
"links":
[
{
"qualityId":2350582,
"uri":"rtmp://vod.dr.dk/cms/mp4:CMS/Resources/dr.dk/NETTV/DR1/2011/09/18a5c2f8-8802-4de6-9a9d-6b337b95e1ad/Bonderoeven--5-10---7--saeson-_32f7289ed4f9472c805711dfd91fbf90.mp4?ID=983628",
"linkType":"Streaming",
"fileType":"mp4",
"bitrateKbps":1126,
"width":640,
"height":360
},
{
"qualityId":2350583,
"uri":"rtmp://vod.dr.dk/cms/mp4:CMS/Resources/dr.dk/NETTV/DR1/2011/09/18a5c2f8-8802-4de6-9a9d-6b337b95e1ad/Bonderoeven--5-10---7--saeson-_32f7289ed4f9472c805711dfd91fbf90_1.mp4?ID=983628",
"linkType":"Streaming",
"fileType":"mp4",
"bitrateKbps":626,
"width":640,
"height":360
},
{
"qualityId":2350584,
"uri":"rtmp://vod.dr.dk/cms/mp4:CMS/Resources/dr.dk/NETTV/DR1/2011/09/18a5c2f8-8802-4de6-9a9d-6b337b95e1ad/Bonderoeven--5-10---7--saeson-_32f7289ed4f9472c805711dfd91fbf90_2.mp4?ID=983628",
"linkType":"Streaming",
"fileType":"mp4",
"bitrateKbps":376,
"width":320,
"height":180
}
],
"chapters":[],
"productionNumber":"00951134130"
}
Hvor der tydeligvis er en indgang for hver kvalitet. DVS at URLen for den højeste kvalitet er rtmp://vod.dr.dk/cms/mp4:CMS/Resources/dr.dk/NETTV/DR1/2011/09/18a5c2f8-8802-4de6-9a9d-6b337b95e1ad/Bonderoeven--5-10---7--saeson-_32f7289ed4f9472c805711dfd91fbf90.mp4?ID=983628
hvor delen efter ":" er en playpath. Den kan downloades med Linux-programmet rtmpdump med kommandoen
rtmpdump --playpath="mp4:CMS/Resources/dr.dk/NETTV/DR1/2011/09/18a5c2f8-8802-4de6-9a9d-6b337b95e1ad/Bonderoeven--5-10---7--saeson-_32f7289ed4f9472c805711dfd91fbf90.mp4?ID=983628" -r 'rtmp://vod.dr.dk/cms/mp4:CMS/Resources/dr.dk/NETTV/DR1/2011/09/18a5c2f8-8802-4de6-9a9d-6b337b95e1ad/Bonderoeven--5-10---7--saeson-_32f7289ed4f9472c805711dfd91fbf90.mp4?ID=983628' -o br.flv
Tak til marlar i tråden http://www.linuxin.dk/node/17903 for at finde ud af playpath-delen!
Vi mangler stadig at finde links til de gamle afsnit, og til det skal vi gætte {slug} i URLerne. For at finde {slug} for Bonderøven kigger jeg på programseriernes links nederst på siden http://www.dr.dk/nu , og kan se at de er af formen http://www.dr.dk/nu/player/#/bonderoeven/18431 eller http://www.dr.dk/nu/player/#/bonderoeven-retro/13380 . Så siden 18431 var et videoId, gætter jeg på at "bonderoeven" er {slug}. Og ganske rigtigt, så giver http://www.dr.dk/nu/api/programseries/bonderoeven/images/1000x1000.jpg og http://www.dr.dk/nu/api/programseries/bonderoeven/videos et logo samt en liste over episoder med tilhørende downloadlinks.
Kommentarer
Send en kommentar