Skip to content

Commit 740a37a

Browse files
Stypoxlitetex
authored andcommitted
[YouTube] Fix checkstyle issues
1 parent 9dc17cd commit 740a37a

27 files changed

+684
-421
lines changed

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

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
package org.schabi.newpipe.extractor.services.youtube;
22

3+
import static org.schabi.newpipe.extractor.MediaFormat.M4A;
4+
import static org.schabi.newpipe.extractor.MediaFormat.MPEG_4;
5+
import static org.schabi.newpipe.extractor.MediaFormat.WEBM;
6+
import static org.schabi.newpipe.extractor.MediaFormat.WEBMA;
7+
import static org.schabi.newpipe.extractor.MediaFormat.WEBMA_OPUS;
8+
import static org.schabi.newpipe.extractor.MediaFormat.v3GPP;
9+
import static org.schabi.newpipe.extractor.services.youtube.ItagItem.ItagType.AUDIO;
10+
import static org.schabi.newpipe.extractor.services.youtube.ItagItem.ItagType.VIDEO;
11+
import static org.schabi.newpipe.extractor.services.youtube.ItagItem.ItagType.VIDEO_ONLY;
12+
313
import org.schabi.newpipe.extractor.MediaFormat;
414
import org.schabi.newpipe.extractor.exceptions.ParsingException;
515

6-
import static org.schabi.newpipe.extractor.MediaFormat.*;
7-
import static org.schabi.newpipe.extractor.services.youtube.ItagItem.ItagType.*;
8-
916
public class ItagItem {
1017
/**
11-
* List can be found here https://github.com/ytdl-org/youtube-dl/blob/9fc5eafb8e384453a49f7cfe73147be491f0b19d/youtube_dl/extractor/youtube.py#L1071
18+
* List can be found here
19+
* https://github.com/ytdl-org/youtube-dl/blob/9fc5eafb8e384453a49f7cfe73147be491f0b19d/youtube_dl/extractor/youtube.py#L1071
1220
*/
1321
private static final ItagItem[] ITAG_LIST = {
1422
/////////////////////////////////////////////////////
@@ -79,17 +87,17 @@ public class ItagItem {
7987
// Utils
8088
//////////////////////////////////////////////////////////////////////////*/
8189

82-
public static boolean isSupported(int itag) {
83-
for (ItagItem item : ITAG_LIST) {
90+
public static boolean isSupported(final int itag) {
91+
for (final ItagItem item : ITAG_LIST) {
8492
if (itag == item.id) {
8593
return true;
8694
}
8795
}
8896
return false;
8997
}
9098

91-
public static ItagItem getItag(int itagId) throws ParsingException {
92-
for (ItagItem item : ITAG_LIST) {
99+
public static ItagItem getItag(final int itagId) throws ParsingException {
100+
for (final ItagItem item : ITAG_LIST) {
93101
if (itagId == item.id) {
94102
return item;
95103
}
@@ -110,7 +118,10 @@ public enum ItagType {
110118
/**
111119
* Call {@link #ItagItem(int, ItagType, MediaFormat, String, int)} with the fps set to 30.
112120
*/
113-
public ItagItem(int id, ItagType type, MediaFormat format, String resolution) {
121+
public ItagItem(final int id,
122+
final ItagType type,
123+
final MediaFormat format,
124+
final String resolution) {
114125
this.id = id;
115126
this.itagType = type;
116127
this.mediaFormat = format;
@@ -123,15 +134,22 @@ public ItagItem(int id, ItagType type, MediaFormat format, String resolution) {
123134
*
124135
* @param resolution string that will be used in the frontend
125136
*/
126-
public ItagItem(int id, ItagType type, MediaFormat format, String resolution, int fps) {
137+
public ItagItem(final int id,
138+
final ItagType type,
139+
final MediaFormat format,
140+
final String resolution,
141+
final int fps) {
127142
this.id = id;
128143
this.itagType = type;
129144
this.mediaFormat = format;
130145
this.resolutionString = resolution;
131146
this.fps = fps;
132147
}
133148

134-
public ItagItem(int id, ItagType type, MediaFormat format, int avgBitrate) {
149+
public ItagItem(final int id,
150+
final ItagType type,
151+
final MediaFormat format,
152+
final int avgBitrate) {
135153
this.id = id;
136154
this.itagType = type;
137155
this.mediaFormat = format;
@@ -170,71 +188,71 @@ public int getBitrate() {
170188
return bitrate;
171189
}
172190

173-
public void setBitrate(int bitrate) {
191+
public void setBitrate(final int bitrate) {
174192
this.bitrate = bitrate;
175193
}
176194

177195
public int getWidth() {
178196
return width;
179197
}
180198

181-
public void setWidth(int width) {
199+
public void setWidth(final int width) {
182200
this.width = width;
183201
}
184202

185203
public int getHeight() {
186204
return height;
187205
}
188206

189-
public void setHeight(int height) {
207+
public void setHeight(final int height) {
190208
this.height = height;
191209
}
192210

193211
public int getInitStart() {
194212
return initStart;
195213
}
196214

197-
public void setInitStart(int initStart) {
215+
public void setInitStart(final int initStart) {
198216
this.initStart = initStart;
199217
}
200218

201219
public int getInitEnd() {
202220
return initEnd;
203221
}
204222

205-
public void setInitEnd(int initEnd) {
223+
public void setInitEnd(final int initEnd) {
206224
this.initEnd = initEnd;
207225
}
208226

209227
public int getIndexStart() {
210228
return indexStart;
211229
}
212230

213-
public void setIndexStart(int indexStart) {
231+
public void setIndexStart(final int indexStart) {
214232
this.indexStart = indexStart;
215233
}
216234

217235
public int getIndexEnd() {
218236
return indexEnd;
219237
}
220238

221-
public void setIndexEnd(int indexEnd) {
239+
public void setIndexEnd(final int indexEnd) {
222240
this.indexEnd = indexEnd;
223241
}
224242

225243
public String getQuality() {
226244
return quality;
227245
}
228246

229-
public void setQuality(String quality) {
247+
public void setQuality(final String quality) {
230248
this.quality = quality;
231249
}
232250

233251
public String getCodec() {
234252
return codec;
235253
}
236254

237-
public void setCodec(String codec) {
255+
public void setCodec(final String codec) {
238256
this.codec = codec;
239257
}
240258
}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* This class handling fetching the JavaScript file in order to allow other classes to extract the
2020
* needed functions.
2121
*/
22-
public class YoutubeJavaScriptExtractor {
22+
public final class YoutubeJavaScriptExtractor {
2323

2424
private static final String HTTPS = "https:";
2525
private static String cachedJavaScriptCode;
@@ -81,9 +81,10 @@ public static String extractJavaScriptUrl() throws ParsingException {
8181
final String hashPattern = "player\\\\\\/([a-z0-9]{8})\\\\\\/";
8282
final String hash = Parser.matchGroup1(hashPattern, iframeContent);
8383

84-
return String.format("https://www.youtube.com/s/player/%s/player_ias.vflset/en_US/base.js", hash);
85-
86-
} catch (final Exception i) { }
84+
return String.format(
85+
"https://www.youtube.com/s/player/%s/player_ias.vflset/en_US/base.js", hash);
86+
} catch (final Exception ignored) {
87+
}
8788

8889
throw new ParsingException("Iframe API did not provide YouTube player js url");
8990
}
@@ -109,8 +110,8 @@ public static String extractJavaScriptUrl(final String videoId) throws ParsingEx
109110
}
110111
}
111112
}
112-
113-
} catch (final Exception i) { }
113+
} catch (final Exception ignored) {
114+
}
114115

115116
throw new ParsingException("Embedded info did not provide YouTube player js url");
116117
}

0 commit comments

Comments
 (0)