newpipe-extractor-js
Version:
JavaScript/Node.js port of NewPipeExtractor
61 lines • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamingService = void 0;
class StreamingService {
constructor(serviceInfo) {
this.serviceInfo = serviceInfo;
}
/**
* Get service information
*/
getServiceInfo() {
return this.serviceInfo;
}
/**
* Get service ID
*/
getServiceId() {
return this.serviceInfo.serviceId;
}
/**
* Get service name
*/
getServiceName() {
return this.serviceInfo.name;
}
/**
* Get base URL for this service
*/
getBaseUrl() {
return this.serviceInfo.baseUrl;
}
/**
* Check if URL is supported by this service
*/
isUrlSupported(url) {
const linkHandler = this.getLinkHandler();
return linkHandler ? linkHandler.acceptUrl(url) : false;
}
/**
* Extract ID from URL
*/
extractId(url) {
const linkHandler = this.getLinkHandler();
if (!linkHandler) {
throw new Error('Link handler not available for this service');
}
return linkHandler.getId(url);
}
/**
* Create URL from ID
*/
createUrl(id) {
const linkHandler = this.getLinkHandler();
if (!linkHandler) {
throw new Error('Link handler not available for this service');
}
return linkHandler.getUrl(id);
}
}
exports.StreamingService = StreamingService;
//# sourceMappingURL=StreamingService.js.map