decord/source/13902_getHostFromUrl.js
2026-08-25 06:04:03 +00:00

20 lines
501 B
JavaScript

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