9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
import { browserFetch } from './browser-fetch.js';
|
|
export async function fetchDouyinUserVideos(page, secUid, count) {
|
|
const params = new URLSearchParams({
|
|
sec_user_id: secUid,
|
|
max_cursor: '0',
|
|
count: String(count),
|
|
aid: '6383',
|
|
});
|
|
const data = await browserFetch(page, 'GET', `https://www.douyin.com/aweme/v1/web/aweme/post/?${params.toString()}`, {
|
|
headers: { referer: 'https://www.douyin.com/' },
|
|
});
|
|
return data.aweme_list || [];
|
|
}
|
|
export async function fetchDouyinComments(page, awemeId, count) {
|
|
const params = new URLSearchParams({
|
|
aweme_id: awemeId,
|
|
count: String(count),
|
|
cursor: '0',
|
|
aid: '6383',
|
|
});
|
|
const data = await browserFetch(page, 'GET', `https://www.douyin.com/aweme/v1/web/comment/list/?${params.toString()}`, {
|
|
headers: { referer: 'https://www.douyin.com/' },
|
|
});
|
|
return (data.comments || []).slice(0, count).map((comment) => ({
|
|
text: comment.text || '',
|
|
digg_count: comment.digg_count ?? 0,
|
|
nickname: comment.user?.nickname || '',
|
|
}));
|
|
}
|