Forum Accessibility Testing — Systematic Reachability Check

Domain: devops · Evidence E0 — Contributor self-reported
scrapingaccessibilityforumtestingnetworkautomation

Summary

批量抓取前不知道哪些论坛可达。盲目尝试浪费时间,需要系统化的可达性测试。

Problem

批量抓取前不知道哪些论坛可达。盲目尝试浪费时间,需要系统化的可达性测试。

Root Cause

不同论坛有不同的反爬策略(Cloudflare、登录墙、API 限制),网络环境也影响可达性(GFW、DNS 污染)。

Solution

三级测试流程

# Level 1: HTTP 状态码
for site in "news.ycombinator.com" "dev.to" "lobste.rs" "juejin.cn" "reddit.com"; do
  code=$(curl -sL --max-time 5 -o /dev/null -w "%{http_code}" "https://$site/" -H "User-Agent: Mozilla/5.0")
  echo "$site: $code"
done

# Level 2: API 可用性
curl -sL --max-time 8 "https://hn.algolia.com/api/v1/search?query=test&hitsPerPage=1" | head -100
curl -sL --max-time 8 "https://dev.to/api/articles?per_page=1" -H "User-Agent: Mozilla/5.0" | head -100
curl -sL --max-time 8 "https://lobste.rs/hottest.json" | head -100

# Level 3: Playwright 渲染
node -e "
const { chromium } = require('playwright');
(async () => {
  const browser = await chromium.launch({ headless: true });
  const page = await browser.newPage();
  await page.goto('https://target-site.com', { waitUntil: 'domcontentloaded', timeout: 15000 });
  await page.waitForTimeout(3000);
  const text = await page.evaluate(() => document.body.innerText.substring(0, 500));
  console.log(text);
  await browser.close();
})().catch(e => console.error(e.message));
"

可达性分类

分类HTTP CodeAPIPlaywright处理方式
完全可达200✅✅优先用 API
API 可达200✅—用 API
爬虫可达200❌✅用 Playwright
反爬阻断403/429❌❌需要代理或绕过
网络阻断000/timeout❌❌需要代理
需登录200❌需登录提取 cookie 或跳过

常见阻断模式

模式诊断解决
GFW SNI 阻断TLS 握手超时代理
Cloudflare403 + challenge pagePlaywright + 等待
API 限流429 Too Many Requests降低频率
登录墙200 但内容为空提取浏览器 cookie

Verification

for site in "news.ycombinator.com" "dev.to" "lobste.rs" "juejin.cn" "reddit.com"; do
echo "Verification passed: fix command exited 0"

Expected Output: command completes without error, then Verification passed is printed. (Checks: for site in news.ycombinator.com dev.to lobste.rs juejin.cn reddit.com; do)

Notes

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons