Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fbfd20c965 |
@@ -32,7 +32,7 @@ export const getInvidiousSearchURL = (query: string): string =>
|
|||||||
`${INVIDIOUS_API_ENDPOINT}/search?q=${encodeURIComponent(query)}`;
|
`${INVIDIOUS_API_ENDPOINT}/search?q=${encodeURIComponent(query)}`;
|
||||||
|
|
||||||
export const getInvidiousThumbnailURL = (url: string): string =>
|
export const getInvidiousThumbnailURL = (url: string): string =>
|
||||||
`${INVIDIOUS_BASE_URL}${url}`;
|
`${INVIDIOUS_BASE_URL}/${url}`;
|
||||||
|
|
||||||
const preferredThumbnailAPIURL = (thumbnails: InvidiousVideoThumbnail[] | undefined): string => {
|
const preferredThumbnailAPIURL = (thumbnails: InvidiousVideoThumbnail[] | undefined): string => {
|
||||||
if (!thumbnails || thumbnails.length === 0) {
|
if (!thumbnails || thumbnails.length === 0) {
|
||||||
|
|||||||
@@ -118,7 +118,8 @@ apiRouter.get("/thumbnail", withErrorHandling(async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(getInvidiousThumbnailURL(thumbnailUrl));
|
const thumbnailUrlWithoutLeadingSlash = thumbnailUrl.startsWith('/') ? thumbnailUrl.slice(1) : thumbnailUrl;
|
||||||
|
const response = await fetch(getInvidiousThumbnailURL(thumbnailUrlWithoutLeadingSlash));
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user