From fe4030a24783752184a8339954b60f22c65b9b8c Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Fri, 16 Nov 2018 19:52:09 -0800 Subject: [PATCH] Fix ustream link parsing --- package.json | 2 +- src/get-info.js | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index ca531447..270f61e6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.62.0", + "version": "3.62.1", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/get-info.js b/src/get-info.js index 5f16e160..6832ca3f 100644 --- a/src/get-info.js +++ b/src/get-info.js @@ -369,14 +369,7 @@ var Getters = { /* ustream.tv */ us: function (id, callback) { - /** - *2013-09-17 - * They couldn't fucking decide whether channels should - * be at http://www.ustream.tv/channel/foo or just - * http://www.ustream.tv/foo so they do both. - * [](/cleese) - */ - var m = id.match(/([\w]+)|(channel\/[\w]+)/); + var m = id.match(/(channel\/[^?&#]+)/); if (m) { id = m[1]; } else { @@ -386,25 +379,23 @@ var Getters = { var options = { host: "www.ustream.tv", - port: 80, + port: 443, path: "/" + id, method: "GET", timeout: 1000 }; - urlRetrieve(http, options, function (status, data) { + urlRetrieve(https, options, function (status, data) { if(status !== 200) { callback("Ustream HTTP " + status, null); return; } - /** - * Regexing the ID out of the HTML because - * Ustream's API is so horribly documented - * I literally could not figure out how to retrieve - * this information. - * - * [](/eatadick) + /* + * Yes, regexing this information out of the HTML sucks. + * No, there is not a better solution -- it seems IBM + * deprecated the old API (or at least replaced with an + * enterprise API marked "Contact sales") so fuck it. */ var m = data.match(/https:\/\/www\.ustream\.tv\/embed\/(\d+)/); if (m) {