summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-04-21 08:49:49 +0800
committereltrac <hi@eltr.ac>2026-04-21 08:49:49 +0800
commit21d91a46ebe2fb0916460d8f8e26fd3b5c23588f (patch)
tree6a39fe709cbca5e1c2ec7189ed802e9a84b84cbf /content
parent7320be8bf43779a93f8a76d02a314681a44f2359 (diff)
[weekly] new draft
Diffstat (limited to 'content')
-rw-r--r--content/weekly/78.md60
1 files changed, 60 insertions, 0 deletions
diff --git a/content/weekly/78.md b/content/weekly/78.md
new file mode 100644
index 00000000..53ec9b0c
--- /dev/null
+++ b/content/weekly/78.md
@@ -0,0 +1,60 @@
++++
+title = "稻草人周刊 Vol."
+subtitle = ""
+tags = []
+date = 2026-04-21T08:34:43+08:00
+draft = true
+toc = true
++++
+
+Blah, blah.
+
+<!--more-->
+
+---
+
+## 连接
+
+
+---
+
+## 止语
+
+{{< music cover="" title="" artist="" apple="" spotify="" netease="" >}}
+
+
+---
+
+## 星群
+
+### miasma
+
+*本周刊不能讨论的技术*往往使用不道德的网络爬虫获取新鲜的人类内容,他们忽略 `robots.txt` 协议,对服务器发起大量请求,造成负担。Miasma 给这些机器人投毒,把他们困在无止尽的垃圾内容循环中,增加大科技公司处理数据的成本。
+
+简单来说,在网站中添加一个隐藏链接,真人看不到,但爬虫会跟随链接并发送 `GET` 请求。
+
+```html
+<a href="/naughty-bots" style="display: none;" aria-hidden="true" tabindex="-1">
+ Amazing high quality data here!
+</a>
+```
+
+在 Nginx 或 Caddy 等 Web 服务器中,把 `/naughty-bots` 反向代理到 Miasma,接下来它就会为这些不怀好意的爬虫提供无止尽的垃圾内容。这种做法不会误伤,你只需要在 `robots.txt` 里这样写:
+
+```robots
+User-agent: *
+Disallow: /naughty-bots
+```
+
+这样所有听话的爬虫(比如搜索引擎爬虫)都会乖乖地不去动 `/naughty-bots` 路径下的内容,而那些贪婪的、什么都想要的爬虫就会掉进陷阱里。当然,爬虫程序忽略 `/naughty-bots` 路径很简单,所以 Miasma 允许自己配置路径,如果你的文章都在 `/article` 路径下,那么使用 `/post` 路径就不容易被差觉。
+
+我的 [Forgejo 实例]也使用了反爬虫策略,由于不需要 SEO 所以就无差别禁止了,也没有做投毒。Codeberg 使用的应该也是类似的方法,我参考的是 [Yann Esposito 的文章](https://her.esy.fun/posts/0031-how-i-protect-my-forgejo-instance-from-ai-web-crawlers/index.html),简单来说,除了 `User-agent` 是 `git` 和部分特殊路径的请求,都默认返回一个只有 `<script>` 的网页,这个脚本往用户的 Cookies 里写入一个字段,然后刷新页面;拦截器不拦截带有这个 Cookie 的请求,所以刷新后直接放行。由于爬虫不执行 JavaScript 代码也没有 Cookie,就会被这种简单的手段拦截。
+
+这种做法的缺点是,它也错误地拦截了那些禁用 JavaScript 或 Cookie 的用户,所以只能在拦截器页面留下一段说明,友善地请用户打开 JavaScript。不过 Miasma 不会直接拦截整个请求,而是在普通的页面里留下陷阱,大概是更好的做法。
+
+访问:[Miasma](https://github.com/austin-weeks/miasma)
+
+---
+
+## 切片
+