add even more integration tests

This commit is contained in:
Athou
2025-07-21 07:58:59 +02:00
parent c6cc47192c
commit f7ae2e6689
27 changed files with 1772 additions and 107 deletions

View File

@@ -32,6 +32,8 @@ import lombok.extern.slf4j.Slf4j;
@Singleton
public class YoutubeFaviconFetcher extends AbstractFaviconFetcher {
private static final String PART_SNIPPET = "snippet";
private static final JsonPointer CHANNEL_THUMBNAIL_URL = JsonPointer.compile("/items/0/snippet/thumbnails/default/url");
private static final JsonPointer PLAYLIST_CHANNEL_ID = JsonPointer.compile("/items/0/snippet/channelId");
@@ -86,7 +88,7 @@ public class YoutubeFaviconFetcher extends AbstractFaviconFetcher {
bytes = iconResult.getContent();
contentType = iconResult.getContentType();
} catch (Exception e) {
log.error("Failed to retrieve YouTube icon", e);
log.debug("Failed to retrieve YouTube icon", e);
}
if (!isValidIconResponse(bytes, contentType)) {
@@ -98,7 +100,7 @@ public class YoutubeFaviconFetcher extends AbstractFaviconFetcher {
private byte[] fetchForUser(String googleAuthKey, String userId)
throws IOException, NotModifiedException, TooManyRequestsException, HostNotAllowedException, SchemeNotAllowedException {
URI uri = UriBuilder.fromUri("https://www.googleapis.com/youtube/v3/channels")
.queryParam("part", "snippet")
.queryParam("part", PART_SNIPPET)
.queryParam("key", googleAuthKey)
.queryParam("forUsername", userId)
.build();
@@ -108,7 +110,7 @@ public class YoutubeFaviconFetcher extends AbstractFaviconFetcher {
private byte[] fetchForChannel(String googleAuthKey, String channelId)
throws IOException, NotModifiedException, TooManyRequestsException, HostNotAllowedException, SchemeNotAllowedException {
URI uri = UriBuilder.fromUri("https://www.googleapis.com/youtube/v3/channels")
.queryParam("part", "snippet")
.queryParam("part", PART_SNIPPET)
.queryParam("key", googleAuthKey)
.queryParam("id", channelId)
.build();
@@ -118,7 +120,7 @@ public class YoutubeFaviconFetcher extends AbstractFaviconFetcher {
private byte[] fetchForPlaylist(String googleAuthKey, String playlistId)
throws IOException, NotModifiedException, TooManyRequestsException, HostNotAllowedException, SchemeNotAllowedException {
URI uri = UriBuilder.fromUri("https://www.googleapis.com/youtube/v3/playlists")
.queryParam("part", "snippet")
.queryParam("part", PART_SNIPPET)
.queryParam("key", googleAuthKey)
.queryParam("id", playlistId)
.build();