Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/auth/authManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class AuthManager {

// Navigate to explore page
logger.info('Navigating to explore page');
await this.page.goto('https://www.xiaohongshu.com/explore', {
await this.page.goto('https://www.rednote.com/explore', {
waitUntil: 'domcontentloaded',
timeout: timeoutMs
});
Expand All @@ -98,7 +98,7 @@ export class AuthManager {
if (userSidebar) {
const isLoggedIn = await this.page.evaluate(() => {
const sidebarUser = document.querySelector('.user.side-bar-component .channel');
return sidebarUser?.textContent?.trim() === '';
return sidebarUser?.textContent?.trim() === 'Me';
});

if (isLoggedIn) {
Expand Down Expand Up @@ -131,7 +131,7 @@ export class AuthManager {
// Verify the text content
const isLoggedIn = await this.page.evaluate(() => {
const sidebarUser = document.querySelector('.user.side-bar-component .channel');
return sidebarUser?.textContent?.trim() === '';
return sidebarUser?.textContent?.trim() === 'Me';
});

if (!isLoggedIn) {
Expand Down
16 changes: 8 additions & 8 deletions src/tools/rednoteTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export class RedNoteTools {

// Check login status
logger.info('Checking login status')
await this.page.goto('https://www.xiaohongshu.com')
await this.page.goto('https://www.rednote.com')
const isLoggedIn = await this.page.evaluate(() => {
const sidebarUser = document.querySelector('.user.side-bar-component .channel')
return sidebarUser?.textContent?.trim() === ''
return sidebarUser?.textContent?.trim() === 'Me'
})

// If not logged in, perform login
Expand Down Expand Up @@ -98,12 +98,12 @@ export class RedNoteTools {
return xhslinkMatch[1]
}

// 匹配 https://www.xiaohongshu.com/ 开头的链接
const xiaohongshuRegex = /(https?:\/\/(?:www\.)?xiaohongshu\.com\/[^,\s]+)/i
const xiaohongshuMatch = shareText.match(xiaohongshuRegex)
// 匹配 https://www.rednote.com/ 开头的链接
const rednoteRegex = /(https?:\/\/(?:www\.)?rednote\.com\/[^,\s]+)/i
const rednoteMatch = shareText.match(rednoteRegex)

if (xiaohongshuMatch && xiaohongshuMatch[1]) {
return xiaohongshuMatch[1]
if (rednoteMatch && rednoteMatch[1]) {
return rednoteMatch[1]
}

return shareText
Expand All @@ -117,7 +117,7 @@ export class RedNoteTools {

// Navigate to search page
logger.info('Navigating to search page')
await this.page.goto(`https://www.xiaohongshu.com/search_result?keyword=${encodeURIComponent(keywords)}`)
await this.page.goto(`https://www.rednote.com/search_result?keyword=${encodeURIComponent(keywords)}`)

// Wait for search results to load
logger.info('Waiting for search results')
Expand Down