Skip to content

Commit 92a2455

Browse files
committed
More reworks
* Killed StreamType * Move ``Privacy`` out of ``Extractor`` * Reworked YT stream extractor
1 parent 7f6b01e commit 92a2455

File tree

18 files changed

+468
-1149
lines changed

18 files changed

+468
-1149
lines changed

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemsCollector;
2222
import org.schabi.newpipe.extractor.stream.Description;
2323
import org.schabi.newpipe.extractor.stream.StreamExtractor;
24-
import org.schabi.newpipe.extractor.stream.StreamType;
2524
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleProgressiveHTTPDeliveryDataImpl;
2625
import org.schabi.newpipe.extractor.streamdata.format.registry.AudioFormatRegistry;
2726
import org.schabi.newpipe.extractor.streamdata.stream.AudioStream;
@@ -164,14 +163,14 @@ public List<AudioStream> getAudioStreams() {
164163
}
165164

166165
@Override
167-
public long getLength() throws ParsingException {
168-
return (long) albumJson.getArray("trackinfo").getObject(0)
169-
.getDouble("duration");
166+
public boolean isAudioOnly() {
167+
return true;
170168
}
171169

172170
@Override
173-
public StreamType getStreamType() {
174-
return StreamType.AUDIO_STREAM;
171+
public long getLength() throws ParsingException {
172+
return (long) albumJson.getArray("trackinfo").getObject(0)
173+
.getDouble("duration");
175174
}
176175

177176
@Override

extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamExtractor.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
1111
import org.schabi.newpipe.extractor.stream.Description;
1212
import org.schabi.newpipe.extractor.stream.StreamExtractor;
13-
import org.schabi.newpipe.extractor.stream.StreamType;
1413
import org.schabi.newpipe.extractor.streamdata.delivery.DeliveryData;
1514
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleDASHUrlDeliveryDataImpl;
1615
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleHLSDeliveryDataImpl;
@@ -223,11 +222,6 @@ private Stream<MediaCCCLiveStreamMapperDTO> getStreamDTOs(@Nonnull final String
223222
(JsonObject) e.getValue())));
224223
}
225224

226-
@Override
227-
public StreamType getStreamType() throws ParsingException {
228-
return StreamType.LIVE_STREAM;
229-
}
230-
231225
@Override
232226
public boolean isLive() {
233227
return true;

extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCStreamLinkHandlerFactory;
1616
import org.schabi.newpipe.extractor.stream.Description;
1717
import org.schabi.newpipe.extractor.stream.StreamExtractor;
18-
import org.schabi.newpipe.extractor.stream.StreamType;
1918
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleProgressiveHTTPDeliveryDataImpl;
2019
import org.schabi.newpipe.extractor.streamdata.format.registry.AudioFormatRegistry;
2120
import org.schabi.newpipe.extractor.streamdata.format.registry.VideoAudioFormatRegistry;
@@ -126,11 +125,6 @@ private Stream<JsonObject> getRecordingsByMimeType(final String startsWithMimeTy
126125
.startsWith(startsWithMimeType));
127126
}
128127

129-
@Override
130-
public StreamType getStreamType() {
131-
return StreamType.VIDEO_STREAM;
132-
}
133-
134128
@Override
135129
public void onFetchPage(@Nonnull final Downloader downloader)
136130
throws IOException, ExtractionException {

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeSearchQueryHandlerFactory;
2323
import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeStreamLinkHandlerFactory;
2424
import org.schabi.newpipe.extractor.stream.Description;
25+
import org.schabi.newpipe.extractor.stream.Privacy;
2526
import org.schabi.newpipe.extractor.stream.StreamExtractor;
2627
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
27-
import org.schabi.newpipe.extractor.stream.StreamType;
2828
import org.schabi.newpipe.extractor.streamdata.delivery.DeliveryData;
2929
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleHLSDeliveryDataImpl;
3030
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleProgressiveHTTPDeliveryDataImpl;
@@ -260,11 +260,6 @@ public List<SubtitleStream> getSubtitles() {
260260
return subtitles;
261261
}
262262

263-
@Override
264-
public StreamType getStreamType() {
265-
return isLive() ? StreamType.LIVE_STREAM : StreamType.VIDEO_STREAM;
266-
}
267-
268263
@Override
269264
public boolean isLive() {
270265
return json.getBoolean("isLive");

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/extractors/SoundcloudStreamExtractor.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import org.schabi.newpipe.extractor.localization.DateWrapper;
2727
import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper;
2828
import org.schabi.newpipe.extractor.stream.Description;
29+
import org.schabi.newpipe.extractor.stream.Privacy;
2930
import org.schabi.newpipe.extractor.stream.StreamExtractor;
3031
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
31-
import org.schabi.newpipe.extractor.stream.StreamType;
3232
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleHLSDeliveryDataImpl;
3333
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleProgressiveHTTPDeliveryDataImpl;
3434
import org.schabi.newpipe.extractor.streamdata.format.AudioMediaFormat;
@@ -412,17 +412,9 @@ private static String getSingleUrlFromHlsManifest(@Nonnull final String hlsManif
412412
throw new ParsingException("Could not get any URL from HLS manifest");
413413
}
414414

415-
private static String urlEncode(final String value) {
416-
try {
417-
return URLEncoder.encode(value, UTF_8);
418-
} catch (final UnsupportedEncodingException e) {
419-
throw new IllegalStateException(e);
420-
}
421-
}
422-
423415
@Override
424-
public StreamType getStreamType() {
425-
return StreamType.AUDIO_STREAM;
416+
public boolean isAudioOnly() {
417+
return true;
426418
}
427419

428420
@Nullable
@@ -480,4 +472,13 @@ public List<String> getTags() {
480472
}
481473
return tags;
482474
}
475+
476+
477+
private static String urlEncode(final String value) {
478+
try {
479+
return URLEncoder.encode(value, UTF_8);
480+
} catch (final UnsupportedEncodingException e) {
481+
throw new IllegalStateException(e);
482+
}
483+
}
483484
}

0 commit comments

Comments
 (0)