A link counts as shared when a preview app fetches a page, not when Meta's crawlers or robots.txt checks pass by

meta-externalagent and meta-webindexer render the whole site for Meta's
index and were counted as Facebook previews, one per script and stylesheet;
facebookexternalhit's robots.txt checks and Discord's refetches of a card
image it already holds counted too. Google Messages previews are named as
such rather than as iMessage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GwFKMuQnPAEHJ5yA1q4orh
This commit is contained in:
Eric WagonerandClaude Opus 5.5 committed 2026-11-06 20:02:44 -05:00
1 parent 82107f73eb
commit 6970babc7e
1 file changed
+7 -3
+7 -3
View File
@@ -12,11 +12,13 @@ from collections import Counter, defaultdict
BOT = re.compile(r"bot|crawl|spider|slurp|facebookexternalhit|slack|discord|twitter|whatsapp|telegram|preview|fetch|curl|python|go-http|wget|headless|scan|monitor|uptime", re.I)
# Link previews: the app that fetched the page to show it in a conversation. The people
# who click such a link arrive with no referrer, so this is the best sign of where it went.
# Meta's crawlers (meta-externalagent, meta-webindexer) name facebook.com too but share nothing.
UNFURL = [
("Slack", re.compile(r"slack", re.I)),
("Discord", re.compile(r"discord", re.I)),
("Google Messages", re.compile(r"googlemessages", re.I)),
("iMessage", re.compile(r"facebookexternalhit.*twitterbot|applebot.*preview", re.I)),
("Facebook", re.compile(r"facebookexternalhit|facebot|meta-externalagent", re.I)),
("Facebook", re.compile(r"facebookexternalhit|facebot", re.I)),
("WhatsApp", re.compile(r"whatsapp", re.I)),
("Telegram", re.compile(r"telegram", re.I)),
("Reddit", re.compile(r"redditbot", re.I)),
@@ -144,8 +146,10 @@ def scan(day, logs=LOGS):
t["bot"] += 1
t["botAddresses"].add(ip)
service = unfurled_by(ua)
# One share per app and page: a preview is often fetched twice.
if service and (service, path) not in seen_share:
# One share per app and page: a preview is often fetched twice. Only a
# page counts: an app that already holds a preview fetches its card
# image again to show it, and robots.txt and scripts are not shared.
if service and (path in PAGES or path.startswith("/join/")) and (service, path) not in seen_share:
seen_share.add((service, path))
t["shared"][service] += 1
continue