Skip to content

Commit cd42e19

Browse files
committed
More reworks
* Killed StreamType * Move ``Privacy`` out of ``Extractor`` * Reworked YT stream extractor
1 parent a77865b commit cd42e19

18 files changed

Lines changed: 463 additions & 1148 deletions

File tree

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
@@ -20,7 +20,6 @@
2020
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemsCollector;
2121
import org.schabi.newpipe.extractor.stream.Description;
2222
import org.schabi.newpipe.extractor.stream.StreamExtractor;
23-
import org.schabi.newpipe.extractor.stream.StreamType;
2423
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleProgressiveHTTPDeliveryDataImpl;
2524
import org.schabi.newpipe.extractor.streamdata.format.registry.AudioFormatRegistry;
2625
import org.schabi.newpipe.extractor.streamdata.stream.AudioStream;
@@ -158,14 +157,14 @@ public List<AudioStream> getAudioStreams() {
158157
}
159158

160159
@Override
161-
public long getLength() throws ParsingException {
162-
return (long) albumJson.getArray("trackinfo").getObject(0)
163-
.getDouble("duration");
160+
public boolean isAudioOnly() {
161+
return true;
164162
}
165163

166164
@Override
167-
public StreamType getStreamType() {
168-
return StreamType.AUDIO_STREAM;
165+
public long getLength() throws ParsingException {
166+
return (long) albumJson.getArray("trackinfo").getObject(0)
167+
.getDouble("duration");
169168
}
170169

171170
@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
@@ -13,7 +13,6 @@
1313
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
1414
import org.schabi.newpipe.extractor.stream.Description;
1515
import org.schabi.newpipe.extractor.stream.StreamExtractor;
16-
import org.schabi.newpipe.extractor.stream.StreamType;
1716
import org.schabi.newpipe.extractor.streamdata.delivery.DeliveryData;
1817
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleDASHUrlDeliveryDataImpl;
1918
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleHLSDeliveryDataImpl;
@@ -226,11 +225,6 @@ private Stream<MediaCCCLiveStreamMapperDTO> getStreamDTOs(@Nonnull final String
226225
(JsonObject) e.getValue())));
227226
}
228227

229-
@Override
230-
public StreamType getStreamType() throws ParsingException {
231-
return StreamType.LIVE_STREAM;
232-
}
233-
234228
@Override
235229
public boolean isLive() {
236230
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
@@ -21,9 +21,9 @@
2121
import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeSearchQueryHandlerFactory;
2222
import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeStreamLinkHandlerFactory;
2323
import org.schabi.newpipe.extractor.stream.Description;
24+
import org.schabi.newpipe.extractor.stream.Privacy;
2425
import org.schabi.newpipe.extractor.stream.StreamExtractor;
2526
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
26-
import org.schabi.newpipe.extractor.stream.StreamType;
2727
import org.schabi.newpipe.extractor.streamdata.delivery.DeliveryData;
2828
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleHLSDeliveryDataImpl;
2929
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleProgressiveHTTPDeliveryDataImpl;
@@ -259,11 +259,6 @@ public List<SubtitleStream> getSubtitles() {
259259
return subtitles;
260260
}
261261

262-
@Override
263-
public StreamType getStreamType() {
264-
return isLive() ? StreamType.LIVE_STREAM : StreamType.VIDEO_STREAM;
265-
}
266-
267262
@Override
268263
public boolean isLive() {
269264
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
@@ -25,9 +25,9 @@
2525
import org.schabi.newpipe.extractor.localization.DateWrapper;
2626
import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudParsingHelper;
2727
import org.schabi.newpipe.extractor.stream.Description;
28+
import org.schabi.newpipe.extractor.stream.Privacy;
2829
import org.schabi.newpipe.extractor.stream.StreamExtractor;
2930
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
30-
import org.schabi.newpipe.extractor.stream.StreamType;
3131
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleHLSDeliveryDataImpl;
3232
import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleProgressiveHTTPDeliveryDataImpl;
3333
import org.schabi.newpipe.extractor.streamdata.format.AudioMediaFormat;
@@ -402,17 +402,9 @@ private static String getSingleUrlFromHlsManifest(@Nonnull final String hlsManif
402402
throw new ParsingException("Could not get any URL from HLS manifest");
403403
}
404404

405-
private static String urlEncode(final String value) {
406-
try {
407-
return URLEncoder.encode(value, UTF_8);
408-
} catch (final UnsupportedEncodingException e) {
409-
throw new IllegalStateException(e);
410-
}
411-
}
412-
413405
@Override
414-
public StreamType getStreamType() {
415-
return StreamType.AUDIO_STREAM;
406+
public boolean isAudioOnly() {
407+
return true;
416408
}
417409

418410
@Nullable
@@ -470,4 +462,13 @@ public List<String> getTags() {
470462
}
471463
return tags;
472464
}
465+
466+
467+
private static String urlEncode(final String value) {
468+
try {
469+
return URLEncoder.encode(value, UTF_8);
470+
} catch (final UnsupportedEncodingException e) {
471+
throw new IllegalStateException(e);
472+
}
473+
}
473474
}

0 commit comments

Comments
 (0)