Skip to content

Commit dfa4239

Browse files
committed
Fix missing imports and Checkstyle issues
1 parent 6d27996 commit dfa4239

File tree

9 files changed

+18
-9
lines changed

9 files changed

+18
-9
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ private static void extractClientVersionAndKeyFromSwJs()
589589
INNERTUBE_CONTEXT_CLIENT_VERSION_REGEXES, 1);
590590
key = getStringResultFromRegexArray(response, INNERTUBE_API_KEY_REGEXES, 1);
591591
} catch (final Parser.RegexException e) {
592-
throw new ParsingException("Could not extract YouTube WEB InnerTube client version and API key from sw.js", e);
592+
throw new ParsingException("Could not extract YouTube WEB InnerTube client version "
593+
+ "and API key from sw.js", e);
593594
}
594595
keyAndVersionExtracted = true;
595596
}
@@ -649,8 +650,8 @@ private static void extractClientVersionAndKeyFromHtmlSearchResultsPage()
649650
try {
650651
key = getStringResultFromRegexArray(html, INNERTUBE_API_KEY_REGEXES, 1);
651652
} catch (final Parser.RegexException e) {
652-
throw new ParsingException(
653-
"Could not extract YouTube WEB InnerTube client version and API key from HTML search results page", e);
653+
throw new ParsingException("Could not extract YouTube WEB InnerTube client version "
654+
+ "and API key from HTML search results page", e);
654655
}
655656
keyAndVersionExtracted = true;
656657
}
@@ -823,7 +824,7 @@ public static String[] getYoutubeMusicKey()
823824
musicClientName = Parser.matchGroup1(INNERTUBE_CLIENT_NAME_REGEX, html);
824825
}
825826

826-
youtubeMusicKey = new String[] { musicKey, musicClientName, musicClientVersion };
827+
youtubeMusicKey = new String[] {musicKey, musicClientName, musicClientVersion};
827828
return youtubeMusicKey;
828829
}
829830

@@ -1050,15 +1051,15 @@ private static JsonObject getMobilePostResponse(
10501051
final byte[] body,
10511052
@Nonnull final Localization localization,
10521053
@Nonnull final String userAgent,
1053-
@Nonnull final String key,
1054+
@Nonnull final String innerTubeApiKey,
10541055
@Nullable final String endPartOfUrlRequest) throws IOException, ExtractionException {
10551056
final Map<String, List<String>> headers = new HashMap<>();
10561057
headers.put("Content-Type", Collections.singletonList("application/json"));
10571058
headers.put("User-Agent", Collections.singletonList(userAgent));
10581059
headers.put("X-Goog-Api-Format-Version", Collections.singletonList("2"));
10591060

10601061
final String baseEndpointUrl = "https://youtubei.googleapis.com/youtubei/v1/" + endpoint
1061-
+ "?key=" + key + DISABLE_PRETTY_PRINT_PARAMETER;
1062+
+ "?key=" + innerTubeApiKey + DISABLE_PRETTY_PRINT_PARAMETER;
10621063

10631064
final Response response = getDownloader().post(isNullOrEmpty(endPartOfUrlRequest)
10641065
? baseEndpointUrl : baseEndpointUrl + endPartOfUrlRequest,
@@ -1363,6 +1364,7 @@ public static void addClientInfoHeaders(@Nonnull final Map<String, List<String>>
13631364
* @see #CONSENT_COOKIE
13641365
* @param headers the headers which should be completed
13651366
*/
1367+
@SuppressWarnings("ArraysAsListWithZeroOrOneArgument")
13661368
public static void addCookieHeader(@Nonnull final Map<String, List<String>> headers) {
13671369
if (headers.get("Cookie") == null) {
13681370
headers.put("Cookie", Arrays.asList(generateConsentCookie()));

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe.extractor.services.youtube.extractors;
22

3+
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
34
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL;
45
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addClientInfoHeaders;
56
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.fixThumbnailUrl;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe.extractor.services.youtube.extractors;
22

3+
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
34
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL;
45
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addClientInfoHeaders;
56
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractCookieValue;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe.extractor.services.youtube.extractors;
22

3+
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
34
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.fixThumbnailUrl;
45
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject;
56
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getUrlFromNavigationEndpoint;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe.extractor.services.youtube.extractors;
22

3+
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
34
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL;
45
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addClientInfoHeaders;
56
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractPlaylistTypeFromPlaylistUrl;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe.extractor.services.youtube.extractors;
22

3+
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.DISABLE_PRETTY_PRINT_PARAMETER;
34
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL;
45
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getJsonPostResponse;
56
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getKey;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,8 @@ private static void storePlayerJs() throws ParsingException {
10791079
}
10801080
}
10811081

1082-
private static String getDeobfuscationFuncName(final String thePlayerCode) throws DeobfuscateException {
1082+
private static String getDeobfuscationFuncName(final String thePlayerCode)
1083+
throws DeobfuscateException {
10831084
Parser.RegexException exception = null;
10841085
for (final String regex : REGEXES) {
10851086
try {

extractor/src/main/java/org/schabi/newpipe/extractor/utils/RandomStringFromAlphabetGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ private RandomStringFromAlphabetGenerator() {
1717
*
1818
* @param alphabet the characters' alphabet to use
1919
* @param length the length of the returned string (> 0)
20-
* @param random {@link Random} (or better {@link java.security.SecureRandom}) used for generating the random string
20+
* @param random {@link Random} (or better {@link java.security.SecureRandom}) used for
21+
* generating the random string
2122
* @return a random string of the requested length made of only characters from the provided
2223
* alphabet
2324
*/

extractor/src/main/java/org/schabi/newpipe/extractor/utils/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public static boolean isNullOrEmpty(final Collection<?> collection) {
282282
* @param map the {@link Map map} on which check if it's null or empty
283283
* @return whether the {@link Map map} is null or empty
284284
*/
285-
public static <K,V> boolean isNullOrEmpty(final Map<K, V> map) {
285+
public static <K, V> boolean isNullOrEmpty(final Map<K, V> map) {
286286
return map == null || map.isEmpty();
287287
}
288288

0 commit comments

Comments
 (0)