Skip to content

Commit 3ce7f2e

Browse files
committed
Code cleanup
Updated javadoc Cleanup more code * Improve /Add java doc * Remove unused code * Convert TODOs to followup issues
1 parent 0732bef commit 3ce7f2e

13 files changed

Lines changed: 67 additions & 57 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public BandcampSearchStreamInfoItemExtractor(final Element searchResult,
2222
public String getUploaderName() {
2323
final String subhead = resultInfo.getElementsByClass("subhead").text();
2424
final String[] splitBy = subhead.split("by ");
25-
return splitBy.length > 1 ? splitBy[1] : splitBy[0];
25+
return splitBy[splitBy.length > 1 ? 1 : 0];
2626
}
2727

2828
@Nullable

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ public List<VideoAudioStream> getVideoStreams() throws IOException, ExtractionEx
185185
dto.getStreamJsonObj().getArray("videoSize");
186186

187187
return new SimpleVideoAudioStreamImpl(
188-
// TODO: This looks wrong
189188
new VideoAudioFormatRegistry()
190189
.getFromSuffixOrThrow(dto.getUrlKey()),
191190
buildDeliveryData(dto),
@@ -237,4 +236,31 @@ public boolean isLive() {
237236
public String getCategory() {
238237
return group;
239238
}
239+
240+
static final class MediaCCCLiveStreamMapperDTO {
241+
private final JsonObject streamJsonObj;
242+
private final String urlKey;
243+
private final JsonObject urlValue;
244+
245+
MediaCCCLiveStreamMapperDTO(final JsonObject streamJsonObj,
246+
final String urlKey,
247+
final JsonObject urlValue) {
248+
this.streamJsonObj = streamJsonObj;
249+
this.urlKey = urlKey;
250+
this.urlValue = urlValue;
251+
}
252+
253+
JsonObject getStreamJsonObj() {
254+
return streamJsonObj;
255+
}
256+
257+
String getUrlKey() {
258+
return urlKey;
259+
}
260+
261+
JsonObject getUrlValue() {
262+
return urlValue;
263+
}
264+
}
265+
240266
}

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

Lines changed: 0 additions & 29 deletions
This file was deleted.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ private void tryExtractSubtitles() {
400400
baseUrl + JsonUtils.getString(caption, "captionPath");
401401

402402
return new SimpleSubtitleStreamImpl(
403-
// TODO: Check for null
404403
new SubtitleFormatRegistry()
405404
.getFromSuffixOrThrow(
406405
url.substring(url.lastIndexOf(".") + 1)),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private List<AudioStream> extractAudioStreams() {
260260
return null;
261261
}
262262

263-
return (AudioStream) new SimpleAudioStreamImpl(
263+
return new SimpleAudioStreamImpl(
264264
mediaFormat,
265265
protocol.equals("hls")
266266
? new SimpleHLSDeliveryDataImpl(mediaUrl)

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/dashmanifestcreator/AbstractYoutubeDashManifestCreator.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,18 @@
5454
import javax.xml.transform.dom.DOMSource;
5555
import javax.xml.transform.stream.StreamResult;
5656

57-
// TODO: Doc
57+
/**
58+
* Abstract class for YouTube DASH manifest creation.
59+
*
60+
* <p>
61+
* This class includes common methods of manifest creators and useful constants.
62+
* </p>
63+
*
64+
* <p>
65+
* Generation of DASH documents and their conversion as a string is done using external classes
66+
* from {@link org.w3c.dom} and {@link javax.xml} packages.
67+
* </p>
68+
*/
5869
public abstract class AbstractYoutubeDashManifestCreator implements DashManifestCreator {
5970

6071
/**

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,8 @@ public List<AudioStream> getAudioStreams() throws ExtractionException {
614614

615615
@Override
616616
public List<VideoAudioStream> getVideoStreams() throws ExtractionException {
617-
return buildStrems(FORMATS,
617+
return buildStrems(
618+
FORMATS,
618619
ItagFormatRegistry.VIDEO_AUDIO_FORMATS,
619620
(itagInfo, deliveryData) -> new SimpleVideoAudioStreamImpl(
620621
itagInfo.getItagFormat().mediaFormat(),
@@ -1249,6 +1250,19 @@ I extends ItagFormat<?>> List<T> buildStrems(
12491250
}
12501251
}
12511252

1253+
/*
1254+
* Note: We build the manifests for YT ourself because the provided ones (according to AudricV)
1255+
* <ul>
1256+
* <li>aren't working https://github.com/google/ExoPlayer/issues/2422#issuecomment-283080031
1257+
* </li>
1258+
* <li>causes memory problems; TransactionTooLargeException: data parcel size 3174340</li>
1259+
* <li>are not always returned, only for videos with OTF streams, or on (ended or not)
1260+
* livestreams</li>
1261+
* <li>Instead of downloading a 10MB manifest when you can generate one which is 1 or 2MB
1262+
* large</li>
1263+
* <li>Also, this manifest isn't used at all by modern YouTube clients.</li>
1264+
* </ul>
1265+
*/
12521266
@Nonnull
12531267
private <I extends ItagFormat<?>> DeliveryData buildDeliveryData(final ItagInfo<I> itagInfo) {
12541268
final ItagFormatDeliveryData iDeliveryData = itagInfo.getItagFormat().deliveryData();

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/itag/format/registry/ItagFormatRegistry.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121
import java.util.stream.Stream;
2222

2323
// CHECKSTYLE:OFF - Link is too long
24-
// https://github.com/ytdl-org/youtube-dl/blob/9aa8e5340f3d5ece372b983f8e399277ca1f1fe4/youtube_dl/extractor/youtube.py#L1195
24+
/**
25+
* A registry that contains all supported YouTube itags.
26+
* <p>
27+
* For additional information you may also check:
28+
* <ul>
29+
* <li>https://github.com/ytdl-org/youtube-dl/blob/9aa8e5340f3d5ece372b983f8e399277ca1f1fe4/youtube_dl/extractor/youtube.py#L1195</li>
30+
* <li>https://gist.github.com/AgentOak/34d47c65b1d28829bb17c24c04a0096f</li>
31+
* </ul>
32+
*/
2533
// CHECKSTYLE:ON
2634
public final class ItagFormatRegistry {
2735

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/itag/info/ItagInfo.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class ItagInfo<I extends ItagFormat<?>> {
1515
@Nonnull
1616
private final I itagFormat;
1717

18-
// TODO: Maybe generate the streamUrl on-demand and not always instantly?
1918
@Nonnull
2019
private final String streamUrl;
2120

extractor/src/main/java/org/schabi/newpipe/extractor/streamdata/delivery/dashmanifestcreator/DashManifestCreatorConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public final class DashManifestCreatorConstants {
44
private DashManifestCreatorConstants() {
5-
// No impl!
5+
// No impl
66
}
77

88
// XML elements of DASH MPD manifests

0 commit comments

Comments
 (0)