diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java b/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java index 7bdb23aba..3a1980b56 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java @@ -1,5 +1,6 @@ package org.schabi.newpipe.extractor; +import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.linkhandler.LinkHandler; import java.io.Serializable; @@ -72,6 +73,15 @@ public abstract class Info implements Serializable { return serviceId; } + public StreamingService getService() { + try { + return NewPipe.getService(serviceId); + } catch (final ExtractionException e) { + // this should be unreachable, as serviceId certainly refers to a valid service + throw new RuntimeException("Info object has invalid service id", e); + } + } + public String getId() { return id; }