Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump actions/checkout from 3 to 4 #31

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up JDK 11
uses: actions/setup-java@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
build-and-deploy-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up JDK 11
uses: actions/setup-java@v3
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ allprojects {
nanojsonVersion = "1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751"
spotbugsVersion = "4.7.3"
junitVersion = "5.10.0"
checkstyleVersion = "10.4"
checkstyleVersion = "10.12.2"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

import javax.annotation.Nonnull;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Optional;

import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.defaultAlertsCheck;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getJsonPostResponse;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.prepareDesktopJsonBuilder;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

/**
* Shared functions for extracting YouTube channel pages and tabs.
Expand Down Expand Up @@ -51,7 +51,7 @@ public static String resolveChannelId(@Nonnull final String idOrPath)
prepareDesktopJsonBuilder(Localization.DEFAULT, ContentCountry.DEFAULT)
.value("url", "https://www.youtube.com/" + idOrPath)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);

final JsonObject jsonResponse = getJsonPostResponse(
"navigation/resolve_url", body, Localization.DEFAULT);
Expand Down Expand Up @@ -143,7 +143,7 @@ public static ChannelResponseData getChannelResponse(@Nonnull final String chann
.value("browseId", id)
.value("params", parameters)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);

final JsonObject jsonResponse = getJsonPostResponse(
"browse", body, localization);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import static org.schabi.newpipe.extractor.utils.Utils.HTTPS;
import static org.schabi.newpipe.extractor.utils.Utils.getStringResultFromRegexArray;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonBuilder;
Expand Down Expand Up @@ -54,7 +55,6 @@
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
Expand Down Expand Up @@ -553,7 +553,7 @@ public static boolean areHardcodedClientVersionAndKeyValid()
.end()
.value("fetchLiveState", true)
.end()
.end().done().getBytes(StandardCharsets.UTF_8);
.end().done().getBytes(UTF_8);
// @formatter:on

final var headers = getClientHeaders("1", HARDCODED_CLIENT_VERSION);
Expand Down Expand Up @@ -794,7 +794,7 @@ public static boolean isHardcodedYoutubeMusicKeyValid() throws IOException,
.end()
.end()
.value("input", "")
.end().done().getBytes(StandardCharsets.UTF_8);
.end().done().getBytes(UTF_8);
// @formatter:on

final var headers = new HashMap<>(getOriginReferrerHeaders(YOUTUBE_MUSIC_URL));
Expand Down Expand Up @@ -1391,7 +1391,7 @@ public static byte[] createDesktopPlayerBody(
.value(CONTENT_CHECK_OK, true)
.value(RACY_CHECK_OK, true)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);
// @formatter:on
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isTvHtml5SimplyEmbeddedPlayerStreamingUrl;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isWebStreamingUrl;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

import org.schabi.newpipe.extractor.MediaFormat;
import org.schabi.newpipe.extractor.NewPipe;
Expand All @@ -25,7 +26,6 @@

import java.io.IOException;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -623,7 +623,7 @@ public static Response getInitializationResponse(@Nonnull String baseStreamingUr
final var headers = Map.of("User-Agent",
List.of(isAndroidStreamingUrl ? getAndroidUserAgent(null)
: getIosUserAgent(null)));
final byte[] emptyBody = "".getBytes(StandardCharsets.UTF_8);
final byte[] emptyBody = "".getBytes(UTF_8);
return downloader.post(baseStreamingUrl, headers, emptyBody);
} catch (final IOException | ExtractionException e) {
throw new CreationException("Could not get the "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Optional;

Expand All @@ -33,6 +32,7 @@
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.prepareDesktopJsonBuilder;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

/**
* A {@link ChannelTabExtractor} implementation for the YouTube service.
Expand Down Expand Up @@ -423,7 +423,7 @@ private Page getNextPageFrom(final JsonObject continuations,
useVisitorData && channelIds.size() >= 3 ? channelIds.get(2) : null)
.value("continuation", continuation)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);

return new Page(YOUTUBEI_V1_URL + "browse?key=" + getKey()
+ DISABLE_PRETTY_PRINT_PARAMETER, null, channelIds, null, body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonObject;
import com.grack.nanojson.JsonWriter;

import org.schabi.newpipe.extractor.Page;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.comments.CommentsExtractor;
Expand All @@ -19,13 +20,13 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;

import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getJsonPostResponse;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getTextFromObject;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.prepareDesktopJsonBuilder;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;

public class YoutubeCommentsExtractor extends CommentsExtractor {
Expand Down Expand Up @@ -191,7 +192,7 @@ public InfoItemsPage<CommentsInfoItem> getPage(final Page page)
prepareDesktopJsonBuilder(localization, getExtractorContentCountry())
.value("continuation", page.getId())
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);
// @formatter:on

final JsonObject jsonObject = getJsonPostResponse("next", body, localization);
Expand Down Expand Up @@ -272,7 +273,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
prepareDesktopJsonBuilder(localization, getExtractorContentCountry())
.value("videoId", getId())
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);
// @formatter:on

final String initialToken =
Expand All @@ -287,7 +288,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
prepareDesktopJsonBuilder(localization, getExtractorContentCountry())
.value("continuation", initialToken)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);
// @formatter:on

ajaxJson = getJsonPostResponse("next", ajaxBody, localization);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static org.schabi.newpipe.extractor.utils.Utils.getQueryValue;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.stringToURL;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonBuilder;
Expand Down Expand Up @@ -38,7 +39,6 @@

import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -87,7 +87,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
jsonBody.value("playlistIndex", Integer.parseInt(playlistIndexString));
}

final byte[] body = JsonWriter.string(jsonBody.done()).getBytes(StandardCharsets.UTF_8);
final byte[] body = JsonWriter.string(jsonBody.done()).getBytes(UTF_8);

// Cookie is required due to consent
final var headers = getYouTubeHeaders();
Expand Down Expand Up @@ -212,7 +212,7 @@ private Page getNextPageFrom(@Nonnull final JsonObject playlistJson,
.value("playlistIndex", index)
.value("params", params)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);

return new Page(YOUTUBEI_V1_URL + "next?key=" + getKey(), null, null, cookies, body);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.MUSIC_SONGS;
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.MUSIC_VIDEOS;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonObject;
Expand All @@ -38,7 +39,6 @@
import org.schabi.newpipe.extractor.utils.Utils;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -112,7 +112,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
.end()
.value("query", getSearchString())
.value("params", params)
.end().done().getBytes(StandardCharsets.UTF_8);
.end().done().getBytes(UTF_8);
// @formatter:on

final String responseBody = getValidJsonResponseBody(
Expand Down Expand Up @@ -240,7 +240,7 @@ public InfoItemsPage<InfoItem> getPage(final Page page)
.value("enableSafetyMode", false)
.end()
.end()
.end().done().getBytes(StandardCharsets.UTF_8);
.end().done().getBytes(UTF_8);
// @formatter:on

final String responseBody = getValidJsonResponseBody(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.getUrlFromNavigationEndpoint;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.prepareDesktopJsonBuilder;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonObject;
Expand All @@ -32,7 +33,6 @@
import org.schabi.newpipe.extractor.utils.Utils;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -66,7 +66,7 @@ public void onFetchPage(@Nonnull final Downloader downloader) throws IOException
.value("browseId", "VL" + getId())
.value("params", "wgYCCAA%3D") // Show unavailable videos
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);

browseResponse = getJsonPostResponse("browse", body, localization);
YoutubeParsingHelper.defaultAlertsCheck(browseResponse);
Expand Down Expand Up @@ -387,7 +387,7 @@ private Page getNextPageFrom(final JsonArray contents)
getExtractorLocalization(), getExtractorContentCountry())
.value("continuation", continuation)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);

return new Page(YOUTUBEI_V1_URL + "browse?key=" + getKey()
+ DISABLE_PRETTY_PRINT_PARAMETER, body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.prepareDesktopJsonBuilder;
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.getSearchParameter;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonBuilder;
Expand All @@ -30,7 +31,6 @@
import org.schabi.newpipe.extractor.utils.JsonUtils;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;

import javax.annotation.Nonnull;
Expand Down Expand Up @@ -87,7 +87,7 @@ public void onFetchPage(@Nonnull final Downloader downloader) throws IOException
jsonBody.value("params", params);
}

final byte[] body = JsonWriter.string(jsonBody.done()).getBytes(StandardCharsets.UTF_8);
final byte[] body = JsonWriter.string(jsonBody.done()).getBytes(UTF_8);

initialData = getJsonPostResponse("search", body, localization);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ public InfoItemsPage<InfoItem> getPage(final Page page) throws IOException,
getExtractorContentCountry())
.value("continuation", page.getId())
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);
// @formatter:on

final JsonObject ajaxJson = getJsonPostResponse("search", json, localization);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.prepareDesktopJsonBuilder;
import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.prepareIosMobileJsonBuilder;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;

import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonObject;
Expand Down Expand Up @@ -88,7 +89,6 @@
import org.schabi.newpipe.extractor.utils.Utils;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
Expand Down Expand Up @@ -878,7 +878,7 @@ public void onFetchPage(@Nonnull final Downloader downloader)
.value(CONTENT_CHECK_OK, true)
.value(RACY_CHECK_OK, true)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);
nextResponse = getJsonPostResponse(NEXT, body, localization);

// streamType can only have LIVE_STREAM, POST_LIVE_STREAM and VIDEO_STREAM values (see
Expand Down Expand Up @@ -985,7 +985,7 @@ private void fetchAndroidMobileJsonPlayer(@Nonnull final ContentCountry contentC
// using some parameters for Android client requests
.value("params", "CgIQBg")
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);

final JsonObject androidPlayerResponse = getJsonAndroidPostResponse(PLAYER,
mobileBody, localization, "&t=" + generateTParameter()
Expand Down Expand Up @@ -1020,7 +1020,7 @@ private void fetchIosMobileJsonPlayer(@Nonnull final ContentCountry contentCount
.value(CONTENT_CHECK_OK, true)
.value(RACY_CHECK_OK, true)
.done())
.getBytes(StandardCharsets.UTF_8);
.getBytes(UTF_8);

final JsonObject iosPlayerResponse = getJsonIosPostResponse(PLAYER,
mobileBody, localization, "&t=" + generateTParameter()
Expand Down
Loading