Fix ustream link parsing

This commit is contained in:
Calvin Montgomery 2018-11-16 19:52:09 -08:00
parent 4c9e85b293
commit fe4030a247
2 changed files with 9 additions and 18 deletions

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.62.0", "version": "3.62.1",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View File

@ -369,14 +369,7 @@ var Getters = {
/* ustream.tv */ /* ustream.tv */
us: function (id, callback) { us: function (id, callback) {
/** var m = id.match(/(channel\/[^?&#]+)/);
*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]+)/);
if (m) { if (m) {
id = m[1]; id = m[1];
} else { } else {
@ -386,25 +379,23 @@ var Getters = {
var options = { var options = {
host: "www.ustream.tv", host: "www.ustream.tv",
port: 80, port: 443,
path: "/" + id, path: "/" + id,
method: "GET", method: "GET",
timeout: 1000 timeout: 1000
}; };
urlRetrieve(http, options, function (status, data) { urlRetrieve(https, options, function (status, data) {
if(status !== 200) { if(status !== 200) {
callback("Ustream HTTP " + status, null); callback("Ustream HTTP " + status, null);
return; return;
} }
/** /*
* Regexing the ID out of the HTML because * Yes, regexing this information out of the HTML sucks.
* Ustream's API is so horribly documented * No, there is not a better solution -- it seems IBM
* I literally could not figure out how to retrieve * deprecated the old API (or at least replaced with an
* this information. * enterprise API marked "Contact sales") so fuck it.
*
* [](/eatadick)
*/ */
var m = data.match(/https:\/\/www\.ustream\.tv\/embed\/(\d+)/); var m = data.match(/https:\/\/www\.ustream\.tv\/embed\/(\d+)/);
if (m) { if (m) {