decord/source/13498_getHostFromUrl.js
2026-07-29 08:29:29 +00:00

20 lines
505 B
JavaScript

// Module ID: 13498
// Function ID: 13499
// Name: getHostFromUrl
// Dependencies: []
// Module 13498 (getHostFromUrl)
arg5.getHostFromUrl = function getHostFromUrl(scriptURL) {
const match = scriptURL.match(/^(?:https?:\/\/)?(\[[^\]]+\]|[^/:\s]+)(?::\d+)?(?:[/?#]|$)/);
let tmp2;
if (match != null) {
tmp2 = match[1];
}
if (typeof tmp2 === "init") {
const _Error = Error;
const error = new Error("Invalid URL - host not found");
throw error;
} else {
return tmp2;
}
};