Home > Fun, Releases, Uncategorized, Useful Apps > VLC GOMTV SQLive URL extractor

VLC GOMTV SQLive URL extractor

October 25th, 2010 Leave a comment Go to comments

Update 03/11 As far as I know GOMTV has started checking for VLC specific information, so the script probably won’t produce anything that works in VLC anymore. I don’t have time to write a Lua plugin for VLC, but that would be ideal to spoof as GOMPlayer.

Update 01/11/11: Updated user script to reflect Foo’s comment below. Code updated below.

Update 10/28/10: Fixed include of which webpages the greasemonkey script runs on. Before sometimes if the url did not match the one in the instructions it would not show the link.

I’ve have a lot of WIPs so I haven’t updated any of the content on this blog frequently. However, the hassle of watching GSL streams in P.S.T. have gotten to me, and at this point I’d rather sleep than watch Idra, Check, SlayersBoxer, Nada, Fruitdealer play Starcraft 2 live. The issue is that VODs are not free from GOMTV, and the pirated Youtube streams are a bit of a hassle to find. The massive viewers on restreamed livestreams easily reduces any computer and it’s network connection to dust.

One easy work around is to just watch the live streams from GomTV, since they are free even though the VODs are not. 720p HQ quality is offered at a premium, but SQLive is free and acceptable. However, since the hours are ridiculously harsh for people living on the West Coast of North America (3 a.m. to 6 a.m.) the best solution is to just record the live stream.

Luckily someone had figured out how to extract the SQLive stream link from the GOMTV pages with detailed instructions on reddit. However, the instructions are not particularly clear, and it seems GOMTV decided to change some of the URLs slightly. Last night I managed to verify that these instructions work with some modification and it seemed fairly reasonable to right a greasemonkey script, since most likely I will be extracting these links several times per day. Since this is tedious, and partially because I’m lazy, I decided to write a greasemonkey script to do extract the link while suffering from minor insomnia last night.

Usage:

  1. For GSL2, login and go to http://www.gomtv.net/2010gslopens2/live/.
  2. Link will show up in red next to “View Live” at the top of the page.

Greasyscript below: (or download vlcgomgreaser.user)

// ==UserScript==
// @name           VLCGOMGreaser
// @namespace      hawflakes.unoc.net
// @description    Get VLC link from GOMTV SQLive
// @include        http://www.gomtv.net/*/live/*
// ==/UserScript==
 
//
 
var script = findXPathNode("//div[@id=\"league_mainBody\"]/script");
var scriptcontent = script.innerHTML;
var start = scriptcontent.indexOf("goxUrl");
var start = scriptcontent.indexOf("http", start);
var url = scriptcontent.substring(start, scriptcontent.indexOf(";", start+1));
var url = url.replace(/strLevel=[^&]+/, "strLevel=SQTest");
var url = url.replace(/&title=[^;]+/, "");
 
var linkpage = get(url,"",showlink);
 
function showlink(client,info) {
	var contents = client.responseText;
	var start = contents.indexOf("LiveAddr=") + "LiveAddr=".length;
	var end = contents.indexOf(";\"/");
	var url = unescape(contents.substring(start,end));
 
	var insertion = findXPathNode("//*[@id=\"chmenu_title_container\"]");
	insertion.innerHTML += "<a href="\">"+url+"</a>";
}
 
function get(url, data, cb,info) {
	var client = new XMLHttpRequest();
	client.open("GET",url,true);
 
	client.onreadystatechange = function () {
		if(client.readyState==4) {
 
			cb(client,info);
 
		}
	}
	client.send(null);
}
 
function findXPathNode(xpath, start,doc)
{
	var result = (doc == null ? document : doc).evaluate(xpath,(start == null ? document : start), null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE ,null);
	return (result.snapshotLength &gt; 0 ? result.snapshotItem(0) : null);
}
  • C

    Could you explain how to use this more clearly? I installed the script, but I still can’t watch set 2 or 3?

    • http://jonblog.wong.lan Jon

      Sorry. The extractor is for SQLive. Not for the VODs.

  • ddrt

    It didn’t work for me in chromium or Firefox. I didn’t see a red link next to any of the stream buttons or on the front page after downloading the extension.

    • http://jonblog.wong.lan Jon

      An easy check is if you log into GOMTV and you can view a valid link when pressing SQLive the script will work. Otherwise it will not. There are a some reasons why it won’t work. No live stream exists at 2am PST, GSL starts at 3am. GOMTV changed their link structure (don’t think this is true, but I’m not entirely sure since I didn’t try last night.). You also need to be logged in obviously to see the SQLive link.

  • foo

    Since the structure of the page has change,

    use:

    var script = findXPathNode(“//div[@id=\"league_mainBody\"]/script”);
    var scriptcontent = script.innerHTML;

    var start = scriptcontent.indexOf(“goxUrl”);
    var start = scriptcontent.indexOf(“http”, start);

    var url = scriptcontent.substring(start, scriptcontent.indexOf(“;”, start+1));
    var url = url.replace(/strLevel=[^&]+/, “strLevel=SQTest”);
    var url = url.replace(/&title=[^;]+/, “”);

    instead of

    var script = findXPathNode(“//div[@id=\"livepage_view_1\"]/div/script”);
    var scriptcontent = script.innerHTML;

    var start = scriptcontent.indexOf(“document.location.href”);
    var start = scriptcontent.indexOf(“http”,start);
    var url = scriptcontent.substring(start,scriptcontent.indexOf(“;”,start+1)-1);

  • foo

    foo :
    Why did you delete my poste explaining how to update your script (which no longer works)?

    sorry that was bullshit, but I swear to god, I couldn’t find my post above, very wired.

    • http://jonblog.wong.lan Jon

      Sorry. I monitor the comment posts as an attempted deterrent against spammers. I’ll check out your changes tonight, and if it checks out I’ll make an edit to the post.

  • buggotard

    Hey, thanks for the script! Easier to watch GSL in Linux with it. The code on the page is quite botched. The code in the link works but you should change the end variable to this:
    var end = contents.indexOf(“"\”/>”);

    I got a ” at the end of the url.
    Cheers!

    • http://jonblog.wong.lan Jon

      You’re absolutely right about the silly quotation character. I have no idea how to get it to work in wordpress. It keeps on killing me a little each time when I try to manually correct it.

  • buggotard

    @buggotard
    Hmm, I see the problem now. It should read:
    var end = contents.indexOf(“&quot;\”/>”);

    Hope it’s right now. Didn’t consider that the browser might parse the html code :)

  • buggotard

    @Jon
    I think my wife has the same problem on her blog. I’ve been meaning to fix it but haven’t gotten around to it yet. The problem I had in my first post is that wordpress didn’t replace the & with &amp;. That made the text be a " instead of the html code &quot;.

    If you change line 22 in the script to the following, it will remove the quote at the end:
    var end = contents.indexOf("&quot;\">");

    Cheers!

  • aptx

    not working as of 2011-03-21

    • http://jonblog.wong.lan Jon

      GomTV has changed their policy. One must now perform the proxy tricks posted on TL to get around the issue.