create-claudeportal 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/lib/scraper.js +12 -4
package/package.json
CHANGED
package/server/lib/scraper.js
CHANGED
|
@@ -92,13 +92,21 @@ function detectSocialLinks(links, html) {
|
|
|
92
92
|
twitter: /(twitter\.com|x\.com)\/([a-zA-Z0-9_]+)/i,
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
// Only search href links (not the full HTML) to avoid matching share buttons, SDKs, and tracking pixels
|
|
96
|
+
const linkText = links.join(' ')
|
|
97
|
+
|
|
98
|
+
// Patterns that indicate a link is NOT a real profile (share buttons, SDKs, login, etc.)
|
|
99
|
+
const falsePositives = /sharer|share\?|dialog\/|connect\.facebook|platform\.twitter|apis\.google|intent\/tweet|oauth|login|signup|widget/i
|
|
96
100
|
|
|
97
101
|
for (const [platform, regex] of Object.entries(patterns)) {
|
|
98
|
-
const match =
|
|
102
|
+
const match = linkText.match(regex)
|
|
99
103
|
if (match) {
|
|
100
|
-
const fullUrlMatch =
|
|
101
|
-
|
|
104
|
+
const fullUrlMatch = linkText.match(new RegExp(`https?://[^"'\\s]*${regex.source}`, 'i'))
|
|
105
|
+
const url = fullUrlMatch ? fullUrlMatch[0] : match[0]
|
|
106
|
+
// Skip if it looks like a share button or SDK, not a real profile
|
|
107
|
+
if (!falsePositives.test(url)) {
|
|
108
|
+
profiles[platform] = { url }
|
|
109
|
+
}
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
112
|
|