Skip to content

Commit 0151d29

Browse files
committed
fix(animegarden): url generate
1 parent 21d4bb2 commit 0151d29

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

packages/animegarden/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function registerCli(
4040
const lib = await anime.library();
4141

4242
for (const { video, resource } of videos) {
43-
const detailURL = `https://animes.garden/api/detail/${resource.provider}/${resource.providerId}`;
43+
const detailURL = `https://animes.garden/detail/${resource.provider}/${resource.providerId}`;
4444

4545
let extra = '';
4646
if (!lib.videos.find((v) => v.source.magnet === video.source.magnet!)) {

packages/animegarden/src/format.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ import width from 'string-width';
55
import { Anime } from '@animespace/core';
66
import { dim, link, underline } from '@breadc/color';
77

8-
import { DOT } from './constant';
9-
108
export function formatAnimeGardenSearchURL(anime: Anime) {
11-
return `https://animes.garden/resources/1?include=${encodeURIComponent(
12-
JSON.stringify(anime.plan.keywords.include)
13-
)}&exclude=${encodeURIComponent(
14-
JSON.stringify(anime.plan.keywords.exclude)
15-
)}&after=${encodeURIComponent(anime.plan.date.toISOString())}`;
9+
const include = anime.plan.keywords.include.map((v) => 'include=' + v);
10+
const exclude = anime.plan.keywords.exclude.map((v) => 'exclude=' + v);
11+
12+
return `https://animes.garden/resources/1?${include.join('&')}&${exclude.join('&')}&after=${encodeURIComponent(anime.plan.date.toISOString())}`;
1613
}
1714

1815
export function printKeywords(anime: Anime, logger: ConsolaInstance) {

packages/bangumi/src/generate.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,19 @@ export async function generatePlan(
109109
}
110110
}
111111

112-
const includeURL = JSON.stringify([[title, ...translations]])
113-
.replace(/\[/g, '%5B')
114-
.replace(/\]/g, '%5D')
115-
.replace(/,/g, '%2C')
116-
.replace(/"/g, '%22')
117-
.replace(/ /g, '%20');
112+
const includeURL = [title, ...translations]
113+
.map((t) =>
114+
t
115+
.replace(/\[/g, '%5B')
116+
.replace(/\]/g, '%5D')
117+
.replace(/,/g, '%2C')
118+
.replace(/"/g, '%22')
119+
.replace(/ /g, '%20')
120+
)
121+
.map((v) => 'include=' + v);
122+
118123
writeln(
119-
` # https://animes.garden/resources/1?include=${includeURL}&after=${encodeURIComponent(
124+
` # https://animes.garden/resources/1?${includeURL.join('&')}&after=${encodeURIComponent(
120125
date.toISOString()
121126
)}`
122127
);

0 commit comments

Comments
 (0)