Skip to content

Commit a724529

Browse files
committed
Readd itags 134 and 136 and format the ItagItem class
1 parent 92c1717 commit a724529

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

  • extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
import org.schabi.newpipe.extractor.MediaFormat;
44
import org.schabi.newpipe.extractor.exceptions.ParsingException;
55

6+
import javax.annotation.Nonnull;
7+
68
import static org.schabi.newpipe.extractor.MediaFormat.*;
79
import static org.schabi.newpipe.extractor.services.youtube.ItagItem.ItagType.*;
810

911
public class ItagItem {
1012
/**
11-
* List can be found here https://github.com/ytdl-org/youtube-dl/blob/9fc5eafb8e384453a49f7cfe73147be491f0b19d/youtube_dl/extractor/youtube.py#L1071
13+
* List can be found here:
14+
* https://github.com/ytdl-org/youtube-dl/blob/c2350cac/youtube_dl/extractor/youtube.py#L1109
1215
*/
1316
private static final ItagItem[] ITAG_LIST = {
1417
/////////////////////////////////////////////////////
@@ -46,13 +49,12 @@ public class ItagItem {
4649
/// VIDEO ONLY ////////////////////////////////////////////
4750
// ID Type Format Resolution FPS ///
4851
/////////////////////////////////////////////////////////
49-
// Don't add VideoOnly streams that have normal variants
5052
new ItagItem(160, VIDEO_ONLY, MPEG_4, "144p"),
5153
new ItagItem(133, VIDEO_ONLY, MPEG_4, "240p"),
52-
// new ItagItem(134, VIDEO_ONLY, MPEG_4, "360p"),
54+
new ItagItem(134, VIDEO_ONLY, MPEG_4, "360p"),
5355
new ItagItem(135, VIDEO_ONLY, MPEG_4, "480p"),
5456
new ItagItem(212, VIDEO_ONLY, MPEG_4, "480p"),
55-
// new ItagItem(136, VIDEO_ONLY, MPEG_4, "720p"),
57+
new ItagItem(136, VIDEO_ONLY, MPEG_4, "720p"),
5658
new ItagItem(298, VIDEO_ONLY, MPEG_4, "720p60", 60),
5759
new ItagItem(137, VIDEO_ONLY, MPEG_4, "1080p"),
5860
new ItagItem(299, VIDEO_ONLY, MPEG_4, "1080p60", 60),
@@ -79,7 +81,7 @@ public class ItagItem {
7981
// Utils
8082
//////////////////////////////////////////////////////////////////////////*/
8183

82-
public static boolean isSupported(int itag) {
84+
public static boolean isSupported(final int itag) {
8385
for (ItagItem item : ITAG_LIST) {
8486
if (itag == item.id) {
8587
return true;
@@ -88,7 +90,8 @@ public static boolean isSupported(int itag) {
8890
return false;
8991
}
9092

91-
public static ItagItem getItag(int itagId) throws ParsingException {
93+
@Nonnull
94+
public static ItagItem getItag(final int itagId) throws ParsingException {
9295
for (ItagItem item : ITAG_LIST) {
9396
if (itagId == item.id) {
9497
return item;
@@ -110,7 +113,10 @@ public enum ItagType {
110113
/**
111114
* Call {@link #ItagItem(int, ItagType, MediaFormat, String, int)} with the fps set to 30.
112115
*/
113-
public ItagItem(int id, ItagType type, MediaFormat format, String resolution) {
116+
public ItagItem(final int id,
117+
final ItagType type,
118+
final MediaFormat format,
119+
final String resolution) {
114120
this.id = id;
115121
this.itagType = type;
116122
this.mediaFormat = format;
@@ -120,18 +126,23 @@ public ItagItem(int id, ItagType type, MediaFormat format, String resolution) {
120126

121127
/**
122128
* Constructor for videos.
123-
*
124-
* @param resolution string that will be used in the frontend
125129
*/
126-
public ItagItem(int id, ItagType type, MediaFormat format, String resolution, int fps) {
130+
public ItagItem(final int id,
131+
final ItagType type,
132+
final MediaFormat format,
133+
final String resolution,
134+
final int fps) {
127135
this.id = id;
128136
this.itagType = type;
129137
this.mediaFormat = format;
130138
this.resolutionString = resolution;
131139
this.fps = fps;
132140
}
133141

134-
public ItagItem(int id, ItagType type, MediaFormat format, int avgBitrate) {
142+
public ItagItem(final int id,
143+
final ItagType type,
144+
final MediaFormat format,
145+
final int avgBitrate) {
135146
this.id = id;
136147
this.itagType = type;
137148
this.mediaFormat = format;

0 commit comments

Comments
 (0)