decord/source/13517_getHostFromUrl.js
2026-07-31 08:44:05 +00:00

20 lines
529 B
JavaScript

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