Skip to content

Commit 1987678

Browse files
committed
Code cleanup
Updated javadoc Cleanup more code * Improve /Add java doc * Remove unused code * Convert TODOs to followup issues
1 parent 48a9fd3 commit 1987678

File tree

13 files changed

+67
-57
lines changed

13 files changed

+67
-57
lines changed

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
@@ -182,7 +182,6 @@ public List<VideoAudioStream> getVideoStreams() throws IOException, ExtractionEx
182182
dto.getStreamJsonObj().getArray("videoSize");
183183

184184
return new SimpleVideoAudioStreamImpl(
185-
// TODO: This looks wrong
186185
new VideoAudioFormatRegistry()
187186
.getFromSuffixOrThrow(dto.getUrlKey()),
188187
buildDeliveryData(dto),
@@ -234,4 +233,31 @@ public boolean isLive() {
234233
public String getCategory() {
235234
return group;
236235
}
236+
237+
static final class MediaCCCLiveStreamMapperDTO {
238+
private final JsonObject streamJsonObj;
239+
private final String urlKey;
240+
private final JsonObject urlValue;
241+
242+
MediaCCCLiveStreamMapperDTO(final JsonObject streamJsonObj,
243+
final String urlKey,
244+
final JsonObject urlValue) {
245+
this.streamJsonObj = streamJsonObj;
246+
this.urlKey = urlKey;
247+
this.urlValue = urlValue;
248+
}
249+
250+
JsonObject getStreamJsonObj() {
251+
return streamJsonObj;
252+
}
253+
254+
String getUrlKey() {
255+
return urlKey;
256+
}
257+
258+
JsonObject getUrlValue() {
259+
return urlValue;
260+
}
261+
}
262+
237263
}

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
@@ -401,7 +401,6 @@ private void tryExtractSubtitles() {
401401
baseUrl + JsonUtils.getString(caption, "captionPath");
402402

403403
return new SimpleSubtitleStreamImpl(
404-
// TODO: Check for null
405404
new SubtitleFormatRegistry()
406405
.getFromSuffixOrThrow(
407406
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
@@ -270,7 +270,7 @@ private List<AudioStream> extractAudioStreams() {
270270
return null;
271271
}
272272

273-
return (AudioStream) new SimpleAudioStreamImpl(
273+
return new SimpleAudioStreamImpl(
274274
mediaFormat,
275275
protocol.equals("hls")
276276
? 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(),
@@ -1199,6 +1200,19 @@ I extends ItagFormat<?>> List<T> buildStrems(
11991200
}
12001201
}
12011202

1203+
/*
1204+
* Note: We build the manifests for YT ourself because the provided ones (according to AudricV)
1205+
* <ul>
1206+
* <li>aren't working https://github.com/google/ExoPlayer/issues/2422#issuecomment-283080031
1207+
* </li>
1208+
* <li>causes memory problems; TransactionTooLargeException: data parcel size 3174340</li>
1209+
* <li>are not always returned, only for videos with OTF streams, or on (ended or not)
1210+
* livestreams</li>
1211+
* <li>Instead of downloading a 10MB manifest when you can generate one which is 1 or 2MB
1212+
* large</li>
1213+
* <li>Also, this manifest isn't used at all by modern YouTube clients.</li>
1214+
* </ul>
1215+
*/
12021216
@Nonnull
12031217
private <I extends ItagFormat<?>> DeliveryData buildDeliveryData(final ItagInfo<I> itagInfo) {
12041218
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)