-1

I'm loading a JavaScript from an external URL:

jQuery(document).ready(function () {
if (HasFlash()) {
    EmbedViewerSwf(
        "/static/flash/CBV_2p645.swf",
        'mia7777',
        'edge33-b.stream.highwebmedia.com',
        '/xml/viewer.xml',
        '0',
        'login_required_true_if_loggedin',
         '0' ,
        "https://ssl-ccstatic.highwebmedia.com/flash/playerProductInstall.swf",
        'mario4025',
        "$.mydefchatconn('join_group_show')",
        "$.mydefchatconn('spy_on_private')",
        'registration_required()',
        '0',
        "https://ssl-ccstatic.highwebmedia.com/images/flashwatermark.png",
        "chaturbate.com",
        'pbkdf2_sha256%2412000%242NlTeIelZxcU%24j9/x/yjBjRqHJkntlLjDUkBJkh1dEC7XR8sh78/4T2w%3D',
        'd2278438db4d37ad094a07e221b30c89ff07627cd1b1732d2f298328a71e9985',
        '100',
        '100'
    );
}
else {
    var html = "<div id='still_video' style='display: none'>";
    html += "<video id='still_video_object'";
    html += "src='http://origin13.stream.highwebmedia.com:1935/live-origin/mia7777-sd-5fd38820138291f9bcf6baa6ac062829f12567166a09f34d50fd93de58a65c79_aac/playlist.m3u8'";
    html += "width='498px' height='407px'";
    html += "webkit-playsinline autoplay></video></div>";
    $('#still_video_container').html(html);
    $('#still_video').show();
}




    var userAgent = navigator.userAgent;
    if (!($.cookie('supress_bline')) && userAgent.indexOf('bline') == -1  && (userAgent.indexOf('iPhone') >= 0 || userAgent.indexOf('iPod') >= 0)) {
        $('#bline_notice').show();
    }
    $('#dismiss_bline_notice').click(function(e) {
        e.preventDefault();
        $('#bline_notice').hide();
        $.cookie('supress_bline', 1, { expires: 30, path: '/' });
    });
});
}

How can I get the contents of the html variable declared in the code above (using PHP or JavaScript):

 html += "src='http://origin13.stream.highwebmedia.com:1935/live-origin/mia7777-sd-5fd38820138291f9bcf6baa6ac062829f12567166a09f34d50fd93de58a65c79_aac/playlist.m3u8'";

I tried it with document.getElementById and also by parsing the whole HTML on my site and then using document.writeln and getting out the variable, but I'm stuck on this part.

4
  • 3
    I spent 5 full minutes parsing your question and I still have no idea what you're asking for...
    – sebnukem
    Oct 2, 2014 at 20:42
  • the above code posted is on another site (url). i need to get this variable from this site and parse it to my site. so im having an outpout of "src='origin13.stream.highwebmedia.com:1935/live-origin/…'" .. i know its difficult to explain.. Oct 2, 2014 at 20:48
  • its an open source streaming website, so just fetching the url is not a crime ;) Oct 2, 2014 at 20:58
  • then what is google doing, fechting and indexing all sites ;) it is also not a nice way .. Oct 2, 2014 at 21:02

1 Answer 1

0

If you want to do this only with Javascript, you may find cross site scripting issues.

If you really need to parse it, and have permission to do so, you should be doing it server-side, with something like PHP or ASP.NET.

As the actual method to parse it, it might be done using regex (since you know the string starts with "src=' and ends with '";

2
  • hey, do you know how the regex string look like for getting the outpout. have been searching all over the net but cant find a solution.. Oct 3, 2014 at 6:17
  • The regex would be html \+= "src='(.*)'";. This should be enough to get the line you want, with the URL in a matching group. Oct 4, 2014 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.