0

firstly I should write that I am not good in javascript at all :). What I need to do. Lets say I have some webpage, for example http://mediathek.rbb-online.de/rbb-fernsehen/heimatjournal/ulli-zelle-ist-in-brandenburg-unterwegs-ein-ausflug-nach?documentId=15725820

There is video in this page and I want to get straight link to this video and play it from straight typing to url address bar.

<script type="text/javascript">
 <![CDATA[
                  something...
                  something...

                function initPlayer(){
                    jQuery("#player-15725820").empty();

                    something...

                  mediaCollection.addMedia(0);
                  mediaCollection.addMediaStream(0, 1,
                  "rtmp://ondemand.rbb-online.de/ondemand/",
                  "mp4:rbb/heimatjournal/sendung/heimatjournal_20130706_sdg_m_16_9_512x288.mp4", "akamai");
                  mediaCollection.addMedia(1);
                  mediaCollection.addMediaStream(1, 1, "", "http://http-stream.rbb-online.de/rbb/heimatjournal/sendung/heimatjournal_20130706_sdg_m_16_9_512x288.mp4", "akamai");

Is there any way to setup video

"mp4:rbb/heimatjournal/sendung/heimatjournal_20130706_sdg_m_16_9_512x288.mp4

straightly from url like stream??

Jan Bouchner
  • 875
  • 1
  • 14
  • 38
  • You can find more info about running javascript from adress bar by searching `javascript bookmarlket` https://en.wikipedia.org/wiki/Bookmarklet , though this question seems to be about something else. – Qwerty Jun 19 '14 at 10:55

2 Answers2

1

window.location.search contains the querystring as a string. You could split this into an object and retrieve the documentId value.

  1. window.location.search // ?documentId=3243242
  2. Retrieve the documentId value, many ways to do this have been suggested before on stackoverflow
  3. Now you can access the value, something like paramsObj // {documentId: 3243242}

"mp4:rbb/heimatjournal/sendung/heimatjournal_" + paramObj['documentId'] + "_sdg_m_16_9_512x288.mp4"

Then you could use that value to load the corresponding video

Community
  • 1
  • 1
dm03514
  • 54,664
  • 18
  • 108
  • 145
  • @JohnnyGreenwood are you trying to pull `documentId=15725820` and use the value of `documentId` to load `mp4:rbb/heimatjournal/sendung/heimatjournal_{{ documentIdValueHere}}_sdg_m_16_9_512x288.mp4`?? – dm03514 Jul 07 '13 at 17:15
  • @JohnnyGreenwood but `'20130706' !== documentId` – Paul S. Jul 07 '13 at 17:19
  • This is true and great answer but I am afraid that my question is obviously wrong question and actually I'm not even sure if it is possible to do in javascript... I am writing a video crawler. I am able to get this information: – Jan Bouchner Jul 07 '13 at 17:29
  • And I am asking if it is possible to use some information from this output and get url of video (.mp4) and play it... – Jan Bouchner Jul 07 '13 at 17:30
1

It's difficult to understand what you're asking for here, perhaps when on the page you want to run a function such as?

function getMP4Strings(s) {
    var i = -1, j, k, a = [];
    while (-1 !== (i = s.indexOf('mp4', i + 1))) { // for each "mp4"
        j = s.lastIndexOf('"', i) + 1;             // get previous "
        k = s.indexOf('"', i);                     // get next "
        a.push(s.slice(j, k));                     // store string between them
    }
    return a;
}
getMP4Strings(document.body.innerHTML);
/* [
    "mp4:rbb/heimatjournal/sendung/heimatjournal_20130706_sdg_m_16_9_512x288.mp4",
    "mp4:rbb/heimatjournal/sendung/heimatjournal_20130706_sdg_m_16_9_512x288.mp4", 
    "http://http-stream.rbb-online.de/rbb/heimatjournal/sendung/heimatjournal_20130706_sdg_m_16_9_512x288.mp4"
] */
Paul S.
  • 64,864
  • 9
  • 122
  • 138
  • There is a problem that I am writing a video crawler. I am able to get this information – Jan Bouchner Jul 07 '13 at 17:21
  • And I am asking if it is possible to use some information from this output and get url of video (.mp4) and play it... – Jan Bouchner Jul 07 '13 at 17:23
  • In my question there is some Javascript stuff (as I have written.. I dont now anything about javascript)... and I am interested if it is possible to play video in some way.. maybe from this javascript stuff – Jan Bouchner Jul 07 '13 at 17:32
  • @JohnnyGreenwood from the code you posted I cannot see how even the player itself knows how to transform the ID into a url :) Open your console on the network tab, go to a cut down test page, take note of each request made, specifically for things including the ID number, find out where the id-to-url transformation is actually done, you may be required to fetch data. – Paul S. Jul 07 '13 at 17:36