Code cleanup
Updated javadoc Cleanup more code * Improve /Add java doc * Remove unused code * Convert TODOs to followup issues
This commit is contained in:
parent
0732bef14b
commit
3ce7f2ef41
|
@ -22,7 +22,7 @@ public class BandcampSearchStreamInfoItemExtractor extends BandcampStreamInfoIte
|
|||
public String getUploaderName() {
|
||||
final String subhead = resultInfo.getElementsByClass("subhead").text();
|
||||
final String[] splitBy = subhead.split("by ");
|
||||
return splitBy.length > 1 ? splitBy[1] : splitBy[0];
|
||||
return splitBy[splitBy.length > 1 ? 1 : 0];
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -185,7 +185,6 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor {
|
|||
dto.getStreamJsonObj().getArray("videoSize");
|
||||
|
||||
return new SimpleVideoAudioStreamImpl(
|
||||
// TODO: This looks wrong
|
||||
new VideoAudioFormatRegistry()
|
||||
.getFromSuffixOrThrow(dto.getUrlKey()),
|
||||
buildDeliveryData(dto),
|
||||
|
@ -237,4 +236,31 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor {
|
|||
public String getCategory() {
|
||||
return group;
|
||||
}
|
||||
|
||||
static final class MediaCCCLiveStreamMapperDTO {
|
||||
private final JsonObject streamJsonObj;
|
||||
private final String urlKey;
|
||||
private final JsonObject urlValue;
|
||||
|
||||
MediaCCCLiveStreamMapperDTO(final JsonObject streamJsonObj,
|
||||
final String urlKey,
|
||||
final JsonObject urlValue) {
|
||||
this.streamJsonObj = streamJsonObj;
|
||||
this.urlKey = urlKey;
|
||||
this.urlValue = urlValue;
|
||||
}
|
||||
|
||||
JsonObject getStreamJsonObj() {
|
||||
return streamJsonObj;
|
||||
}
|
||||
|
||||
String getUrlKey() {
|
||||
return urlKey;
|
||||
}
|
||||
|
||||
JsonObject getUrlValue() {
|
||||
return urlValue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
package org.schabi.newpipe.extractor.services.media_ccc.extractors;
|
||||
|
||||
import com.grack.nanojson.JsonObject;
|
||||
|
||||
final class MediaCCCLiveStreamMapperDTO {
|
||||
private final JsonObject streamJsonObj;
|
||||
private final String urlKey;
|
||||
private final JsonObject urlValue;
|
||||
|
||||
MediaCCCLiveStreamMapperDTO(final JsonObject streamJsonObj,
|
||||
final String urlKey,
|
||||
final JsonObject urlValue) {
|
||||
this.streamJsonObj = streamJsonObj;
|
||||
this.urlKey = urlKey;
|
||||
this.urlValue = urlValue;
|
||||
}
|
||||
|
||||
JsonObject getStreamJsonObj() {
|
||||
return streamJsonObj;
|
||||
}
|
||||
|
||||
String getUrlKey() {
|
||||
return urlKey;
|
||||
}
|
||||
|
||||
JsonObject getUrlValue() {
|
||||
return urlValue;
|
||||
}
|
||||
}
|
|
@ -400,7 +400,6 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
baseUrl + JsonUtils.getString(caption, "captionPath");
|
||||
|
||||
return new SimpleSubtitleStreamImpl(
|
||||
// TODO: Check for null
|
||||
new SubtitleFormatRegistry()
|
||||
.getFromSuffixOrThrow(
|
||||
url.substring(url.lastIndexOf(".") + 1)),
|
||||
|
|
|
@ -260,7 +260,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
return null;
|
||||
}
|
||||
|
||||
return (AudioStream) new SimpleAudioStreamImpl(
|
||||
return new SimpleAudioStreamImpl(
|
||||
mediaFormat,
|
||||
protocol.equals("hls")
|
||||
? new SimpleHLSDeliveryDataImpl(mediaUrl)
|
||||
|
|
|
@ -54,7 +54,18 @@ import javax.xml.transform.TransformerFactory;
|
|||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
// TODO: Doc
|
||||
/**
|
||||
* Abstract class for YouTube DASH manifest creation.
|
||||
*
|
||||
* <p>
|
||||
* This class includes common methods of manifest creators and useful constants.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Generation of DASH documents and their conversion as a string is done using external classes
|
||||
* from {@link org.w3c.dom} and {@link javax.xml} packages.
|
||||
* </p>
|
||||
*/
|
||||
public abstract class AbstractYoutubeDashManifestCreator implements DashManifestCreator {
|
||||
|
||||
/**
|
||||
|
|
|
@ -614,7 +614,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
|
||||
@Override
|
||||
public List<VideoAudioStream> getVideoStreams() throws ExtractionException {
|
||||
return buildStrems(FORMATS,
|
||||
return buildStrems(
|
||||
FORMATS,
|
||||
ItagFormatRegistry.VIDEO_AUDIO_FORMATS,
|
||||
(itagInfo, deliveryData) -> new SimpleVideoAudioStreamImpl(
|
||||
itagInfo.getItagFormat().mediaFormat(),
|
||||
|
@ -1249,6 +1250,19 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: We build the manifests for YT ourself because the provided ones (according to AudricV)
|
||||
* <ul>
|
||||
* <li>aren't working https://github.com/google/ExoPlayer/issues/2422#issuecomment-283080031
|
||||
* </li>
|
||||
* <li>causes memory problems; TransactionTooLargeException: data parcel size 3174340</li>
|
||||
* <li>are not always returned, only for videos with OTF streams, or on (ended or not)
|
||||
* livestreams</li>
|
||||
* <li>Instead of downloading a 10MB manifest when you can generate one which is 1 or 2MB
|
||||
* large</li>
|
||||
* <li>Also, this manifest isn't used at all by modern YouTube clients.</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Nonnull
|
||||
private <I extends ItagFormat<?>> DeliveryData buildDeliveryData(final ItagInfo<I> itagInfo) {
|
||||
final ItagFormatDeliveryData iDeliveryData = itagInfo.getItagFormat().deliveryData();
|
||||
|
|
|
@ -21,7 +21,15 @@ import org.schabi.newpipe.extractor.streamdata.format.registry.AudioFormatRegist
|
|||
import java.util.stream.Stream;
|
||||
|
||||
// CHECKSTYLE:OFF - Link is too long
|
||||
// https://github.com/ytdl-org/youtube-dl/blob/9aa8e5340f3d5ece372b983f8e399277ca1f1fe4/youtube_dl/extractor/youtube.py#L1195
|
||||
/**
|
||||
* A registry that contains all supported YouTube itags.
|
||||
* <p>
|
||||
* For additional information you may also check:
|
||||
* <ul>
|
||||
* <li>https://github.com/ytdl-org/youtube-dl/blob/9aa8e5340f3d5ece372b983f8e399277ca1f1fe4/youtube_dl/extractor/youtube.py#L1195</li>
|
||||
* <li>https://gist.github.com/AgentOak/34d47c65b1d28829bb17c24c04a0096f</li>
|
||||
* </ul>
|
||||
*/
|
||||
// CHECKSTYLE:ON
|
||||
public final class ItagFormatRegistry {
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ public class ItagInfo<I extends ItagFormat<?>> {
|
|||
@Nonnull
|
||||
private final I itagFormat;
|
||||
|
||||
// TODO: Maybe generate the streamUrl on-demand and not always instantly?
|
||||
@Nonnull
|
||||
private final String streamUrl;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.schabi.newpipe.extractor.streamdata.delivery.dashmanifestcreator;
|
|||
|
||||
public final class DashManifestCreatorConstants {
|
||||
private DashManifestCreatorConstants() {
|
||||
// No impl!
|
||||
// No impl
|
||||
}
|
||||
|
||||
// XML elements of DASH MPD manifests
|
||||
|
|
|
@ -7,17 +7,6 @@ import java.util.Objects;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Note we build the manifests for YT ourself because the provided ones (according to TiA4f8R)
|
||||
* <ul>
|
||||
* <li>aren't working https://github.com/google/ExoPlayer/issues/2422#issuecomment-283080031</li>
|
||||
* <li>causes memory problems; TransactionTooLargeException: data parcel size 3174340</li>
|
||||
* <li>are not always returned, only for videos with OTF streams, or on (ended or not)
|
||||
* livestreams</li>
|
||||
* <li>Instead of downloading a 10MB manifest when you can generate one which is 1 or 2MB large</li>
|
||||
* <li>Also, this manifest isn't used at all by modern YouTube clients.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public class SimpleDASHManifestDeliveryDataImpl extends AbstractDeliveryDataImpl
|
||||
implements DASHManifestDeliveryData {
|
||||
@Nonnull
|
||||
|
|
|
@ -36,13 +36,6 @@ public class SimpleVideoAudioStreamImpl extends AbstractStreamImpl<VideoAudioMed
|
|||
this(mediaFormat, deliveryData, videoQualityData, UNKNOWN_AVG_BITRATE);
|
||||
}
|
||||
|
||||
public SimpleVideoAudioStreamImpl(
|
||||
@Nonnull final VideoAudioMediaFormat mediaFormat,
|
||||
@Nonnull final DeliveryData deliveryData
|
||||
) {
|
||||
this(mediaFormat, deliveryData, VideoQualityData.fromUnknown());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public VideoQualityData videoQualityData() {
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.schabi.newpipe.extractor.utils;
|
|||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* class to create a pair of objects.
|
||||
* Class to create a pair of objects.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
|
|
Loading…
Reference in New Issue