INNER CODE UNIT · TypeScript
getPlatformContent
RyanYipeng/SyncCaster · apps/extension/src/content-scripts/index.ts:498
const getPlatformContent = (): HTMLElement | null => {
// CSDN 专用选择器 - 只选择正文内容区域
if (hostname.includes('csdn.net')) {
const csdnContent = document.querySelector('#content_views') as HTMLElement;
if (csdnContent) return csdnContent;
const articleContent = document.querySelector('.article_content') as HTMLElement;
if (articleContent) return articleContent;
}
// 知乎专用选择器
if (hostname.includes('zhihu.com')) {
const zhihuContent = document.querySelector('.Post-RichTextContainer') as HTMLElement;
if (zhihuContent) return zhihuContent;
}
// 掘金专用选择器
if (hostname.includes('juejin.cn')) {
const juejinContent = document.querySelector('.article-content') as HTMLElement;