From 804e57004fdce10624d4cc82a997e750071e4f73 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sat, 26 Mar 2022 19:46:10 +0100 Subject: [PATCH] Fixed new checkstyle problems from dev --- .../linkhandler/ListLinkHandlerFactory.java | 1 - .../SearchQueryHandlerFactory.java | 5 ++--- .../playlist/PlaylistInfoItemsCollector.java | 2 +- .../YoutubeMixPlaylistExtractor.java | 1 + .../extractors/YoutubePlaylistExtractor.java | 1 + .../extractors/YoutubeStreamExtractor.java | 19 +++++++++---------- .../YoutubeStreamInfoItemExtractor.java | 2 +- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/ListLinkHandlerFactory.java b/extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/ListLinkHandlerFactory.java index 9b6714f7c5..0d67fe6e12 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/ListLinkHandlerFactory.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/ListLinkHandlerFactory.java @@ -4,7 +4,6 @@ import org.schabi.newpipe.extractor.utils.Utils; import java.util.ArrayList; -import java.util.Collections; import java.util.List; public abstract class ListLinkHandlerFactory extends LinkHandlerFactory { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/SearchQueryHandlerFactory.java b/extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/SearchQueryHandlerFactory.java index 4a1ee776a5..4a27d4a6cf 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/SearchQueryHandlerFactory.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/linkhandler/SearchQueryHandlerFactory.java @@ -1,13 +1,12 @@ package org.schabi.newpipe.extractor.linkhandler; +import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING; + import org.schabi.newpipe.extractor.exceptions.ParsingException; -import java.util.ArrayList; import java.util.Collections; import java.util.List; -import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING; - public abstract class SearchQueryHandlerFactory extends ListLinkHandlerFactory { /////////////////////////////////// diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemsCollector.java b/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemsCollector.java index 87e0d16f14..328f12617b 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemsCollector.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemsCollector.java @@ -33,7 +33,7 @@ public PlaylistInfoItem extract(final PlaylistInfoItemExtractor extractor) } try { resultItem.setPlaylistType(extractor.getPlaylistType()); - } catch (Exception e) { + } catch (final Exception e) { addError(e); } return resultItem; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java index 00f222dbe8..327c107723 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java @@ -3,6 +3,7 @@ import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addClientInfoHeaders; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractCookieValue; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractPlaylistTypeFromPlaylistId; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getKey; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getValidJsonResponseBody; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.prepareDesktopJsonBuilder; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java index 1d1ecc85ae..f52608dfd9 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java @@ -2,6 +2,7 @@ import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.YOUTUBEI_V1_URL; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.addClientInfoHeaders; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.extractPlaylistTypeFromPlaylistUrl; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.fixThumbnailUrl; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getJsonPostResponse; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getKey; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 7aef5081ac..e95a2fcd75 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -49,7 +49,6 @@ import org.schabi.newpipe.extractor.stream.Frameset; import org.schabi.newpipe.extractor.stream.Stream; import org.schabi.newpipe.extractor.stream.StreamExtractor; -import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; import org.schabi.newpipe.extractor.stream.StreamSegment; import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.extractor.stream.SubtitlesStream; @@ -206,7 +205,7 @@ public String getTextualUploadDate() throws ParsingException { // TODO: this parses English formatted dates only, we need a better approach to parse // the textual date final LocalDate localDate = LocalDate.parse(getTextFromObject( - getVideoPrimaryInfoRenderer().getObject("dateText")), + getVideoPrimaryInfoRenderer().getObject("dateText")), DateTimeFormatter.ofPattern("dd MMM yyyy", Locale.ENGLISH)); return DateTimeFormatter.ISO_LOCAL_DATE.format(localDate); } catch (final Exception ignored) { @@ -730,9 +729,9 @@ public void onFetchPage(@Nonnull final Downloader downloader) final Localization localization = getExtractorLocalization(); final ContentCountry contentCountry = getExtractorContentCountry(); final byte[] body = JsonWriter.string(prepareDesktopJsonBuilder( - localization, contentCountry) - .value("videoId", videoId) - .done()) + localization, contentCountry) + .value("videoId", videoId) + .done()) .getBytes(UTF_8); // Put the sts string if we already know it so we don't have to fetch again the player @@ -781,8 +780,8 @@ public void onFetchPage(@Nonnull final Downloader downloader) if (ageRestricted) { final byte[] ageRestrictedBody = JsonWriter.string(prepareDesktopEmbedVideoJsonBuilder( - localization, contentCountry, videoId) - .done()) + localization, contentCountry, videoId) + .done()) .getBytes(UTF_8); nextResponse = getJsonPostResponse("next", ageRestrictedBody, localization); } else { @@ -865,9 +864,9 @@ private void fetchAndroidMobileJsonPlayer(final ContentCountry contentCountry, final String videoId) throws IOException, ExtractionException { final byte[] mobileBody = JsonWriter.string(prepareAndroidMobileJsonBuilder( - localization, contentCountry) - .value("videoId", videoId) - .done()) + localization, contentCountry) + .value("videoId", videoId) + .done()) .getBytes(UTF_8); final JsonObject mobilePlayerResponse = getJsonMobilePostResponse("player", mobileBody, contentCountry, localization); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java index 9a47365d41..67be244d07 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java @@ -1,7 +1,7 @@ package org.schabi.newpipe.extractor.services.youtube.extractors; -import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.fixThumbnailUrl; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject; +import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getThumbnailUrlFromInfoItem; import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getUrlFromNavigationEndpoint; import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING; import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;