整合小红书页面:内联扫码登录、用户主页、移除独立登录和内容浏览页
- 新增 XiaohongshuPage:顶部搜索栏、登录用户头像/ID、退出按钮 - 未登录时内联显示二维码,无需跳转独立登录页 - 点击笔记作者可打开用户主页 slide-over(复用 UserCard) - 修复用户主页关注/粉丝/获赞数为零:选择器从 .data-area .data-item 改为 .user-interactions > div - 修复用户头像选择器:img.user-image(img 本身带该 class) - backend LoginStatus 新增 avatar/userId 字段,登录状态接口返回头像和用户 ID - 删除 LoginPage、BrowserPage,侧边栏精简为小红书单入口
This commit is contained in:
@@ -27,13 +27,37 @@ async function main() {
|
||||
const nickname = await page.$eval('.user-info .user-name', el => el.textContent?.trim() ?? '').catch(() => 'NOT FOUND');
|
||||
console.log('nickname:', nickname);
|
||||
|
||||
const feeds = await page.$$('.feeds-container .note-item');
|
||||
console.log('note items:', feeds.length);
|
||||
if (feeds.length > 0) {
|
||||
const href = await feeds[0]!.$eval('a.cover', el => el.getAttribute('href') ?? '').catch(() => '');
|
||||
console.log('first note href:', href);
|
||||
// Check __INITIAL_STATE__
|
||||
const initialState = await page.evaluate(() => {
|
||||
const s = (window as unknown as Record<string, unknown>).__INITIAL_STATE__;
|
||||
return s ? JSON.stringify(s) : null;
|
||||
}).catch(() => null);
|
||||
|
||||
if (!initialState) {
|
||||
console.log('__INITIAL_STATE__: NOT FOUND');
|
||||
} else {
|
||||
const state = JSON.parse(initialState);
|
||||
const keys = Object.keys(state);
|
||||
console.log('\n__INITIAL_STATE__ top-level keys:', keys);
|
||||
|
||||
// Dump user / userProfile subtrees
|
||||
if (state.user) console.log('\nstate.user keys:', Object.keys(state.user));
|
||||
if (state.user?.userPageData) {
|
||||
const upd = state.user.userPageData;
|
||||
console.log('\nstate.user.userPageData keys:', Object.keys(upd));
|
||||
console.log(' basicInfo:', JSON.stringify(upd.basicInfo)?.slice(0, 300));
|
||||
console.log(' interactions:', JSON.stringify(upd.interactions));
|
||||
console.log(' noteCount:', upd.noteCount, '/ note_count:', upd.note_count);
|
||||
}
|
||||
if (state.userProfile) {
|
||||
console.log('\nstate.userProfile keys:', Object.keys(state.userProfile));
|
||||
console.log(' userInfo:', JSON.stringify(state.userProfile.userInfo)?.slice(0, 300));
|
||||
}
|
||||
}
|
||||
|
||||
const feeds = await page.$$('.feeds-container .note-item');
|
||||
console.log('\nnote items:', feeds.length);
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
main().catch(e => { console.error(e); process.exit(1); });
|
||||
|
||||
Reference in New Issue
Block a user