mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-13 22:00:32 +05:30
-Added hls manifest url extraction.
-Changed manifest url fields to nonnull.
This commit is contained in:
parent
e851c12230
commit
690f241357
@ -116,9 +116,16 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
||||
return SoundcloudParsingHelper.getAvatarUrl(track);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDashMpdUrl() {
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHlsUrl() throws ParsingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,12 +66,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
public class LiveStreamException extends ContentNotAvailableException {
|
||||
LiveStreamException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
public class SubtitlesException extends ContentNotAvailableException {
|
||||
SubtitlesException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
@ -338,6 +332,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDashMpdUrl() throws ParsingException {
|
||||
assertPageFetched();
|
||||
@ -365,6 +360,24 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getHlsUrl() throws ParsingException {
|
||||
assertPageFetched();
|
||||
try {
|
||||
String hlsvp;
|
||||
if (playerArgs != null && playerArgs.isString("hlsvp")) {
|
||||
hlsvp = playerArgs.getString("hlsvp", "");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
return hlsvp;
|
||||
} catch (Exception e) {
|
||||
throw new ParsingException("Could not get hls manifest url", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AudioStream> getAudioStreams() throws IOException, ExtractionException {
|
||||
assertPageFetched();
|
||||
|
@ -126,7 +126,8 @@ public abstract class StreamExtractor extends Extractor {
|
||||
* @return the url as a string or an empty string
|
||||
* @throws ParsingException if an error occurs while reading
|
||||
*/
|
||||
public abstract String getDashMpdUrl() throws ParsingException;
|
||||
@Nonnull public abstract String getDashMpdUrl() throws ParsingException;
|
||||
@Nonnull public abstract String getHlsUrl() throws ParsingException;
|
||||
public abstract List<AudioStream> getAudioStreams() throws IOException, ExtractionException;
|
||||
public abstract List<VideoStream> getVideoStreams() throws IOException, ExtractionException;
|
||||
public abstract List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionException;
|
||||
|
@ -126,6 +126,10 @@ public class StreamInfo extends Info {
|
||||
return dashMpdUrl;
|
||||
}
|
||||
|
||||
public String getHlsUrl() {
|
||||
return hlsUrl;
|
||||
}
|
||||
|
||||
public StreamInfoItem getNextVideo() {
|
||||
return next_video;
|
||||
}
|
||||
@ -206,6 +210,10 @@ public class StreamInfo extends Info {
|
||||
this.dashMpdUrl = dashMpdUrl;
|
||||
}
|
||||
|
||||
public void setHlsUrl(String hlsUrl) {
|
||||
this.hlsUrl = hlsUrl;
|
||||
}
|
||||
|
||||
public void setNextVideo(StreamInfoItem next_video) {
|
||||
this.next_video = next_video;
|
||||
}
|
||||
@ -298,6 +306,12 @@ public class StreamInfo extends Info {
|
||||
streamInfo.addError(new ExtractionException("Couldn't get Dash manifest", e));
|
||||
}
|
||||
|
||||
try {
|
||||
streamInfo.setHlsUrl(extractor.getHlsUrl());
|
||||
} catch (Exception e) {
|
||||
streamInfo.addError(new ExtractionException("Couldn't get HLS manifest", e));
|
||||
}
|
||||
|
||||
/* Load and extract audio */
|
||||
try {
|
||||
streamInfo.setAudioStreams(extractor.getAudioStreams());
|
||||
@ -447,6 +461,7 @@ public class StreamInfo extends Info {
|
||||
// crawling such a file is not service dependent. Therefore getting audio only streams by yust
|
||||
// providing the dash mpd file will be possible in the future.
|
||||
public String dashMpdUrl;
|
||||
public String hlsUrl;
|
||||
|
||||
public StreamInfoItem next_video;
|
||||
public List<InfoItem> related_streams;
|
||||
|
Loading…
Reference in New Issue
Block a user