Skip to content

Commit 677d8b7

Browse files
wxh06immccn123
authored andcommitted
Update for LentilleDataResponse
1 parent 7e9b385 commit 677d8b7

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

packages/archive/src/lib/list.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ interface PostData {
1919
}
2020

2121
interface PostListResponse {
22-
code: 200;
23-
currentTemplate: "DiscussList";
24-
currentData: {
22+
data: {
2523
forum: ForumData | null;
2624
publicForums: ForumData[];
2725
posts: {
@@ -45,7 +43,7 @@ export default async function getPostList(
4543
false,
4644
);
4745
const {
48-
currentData: {
46+
data: {
4947
posts: { result },
5048
},
5149
} = (await response.json()) as PostListResponse;

packages/archive/src/lib/parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export async function getResponse(
3030
const response = await fetch(url, {
3131
headers: {
3232
"x-luogu-type": "content-only",
33+
"x-lentille-request": "content-only",
3334
...(cookie ? { cookie: process.env.COOKIE! } : {}),
3435
},
3536
cache: "no-cache",

packages/archive/src/lib/post.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ interface ReplyData {
3939
}
4040

4141
interface ResponseBody {
42-
currentData: {
42+
data: {
4343
forum: ForumData;
4444
post: PostData;
4545
replies: ReplyData;
@@ -125,7 +125,7 @@ export async function savePost(
125125
});
126126
};
127127

128-
const { post, replies, forum } = (await fetchPage(1)).currentData;
128+
const { post, replies, forum } = (await fetchPage(1)).data;
129129
const postTime = new Date(post.time * 1000);
130130

131131
await upsertUserSnapshot(prisma, post.author);
@@ -184,7 +184,7 @@ export async function savePost(
184184
)[0];
185185
for (let i = Math.min(pages, maxPages); i > 0; i -= 1) {
186186
// eslint-disable-next-line no-await-in-loop
187-
const { replies: newReplies } = (await fetchPage(i)).currentData;
187+
const { replies: newReplies } = (await fetchPage(i)).data;
188188
// eslint-disable-next-line no-await-in-loop
189189
await saveReplies(newReplies.result);
190190
if (newReplies.result[newReplies.result.length - 1].id <= lastReply)

0 commit comments

Comments
 (0)