niconico:shunga
差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
niconico:shunga [2025/02/04 17:33] – 移除 - 外部编辑 (未知日期) 127.0.0.1 | niconico:shunga [2025/02/04 17:37] (当前版本) – yzqzss | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | {{tag> | ||
+ | <WRAP right> | ||
+ | ^ ニコニコ春画 | ||
+ | | URL | https:// | ||
+ | | 成立于 | ||
+ | | 关闭于 | ||
+ | | 别名 | ||
+ | | 拥有者 | ||
+ | | 数据量 | ||
+ | | project code | [[github> | ||
+ | </ | ||
+ | |||
+ | ====== ニコニコ春画 ====== | ||
+ | |||
+ | ニコニコ春画(NicoNico Shunga)是 ニコニコ静画(NicoNico Seiga)中的 R-15 分类,于 2025-1-29 14:00 (UTC+9) 删除((https:// | ||
+ | |||
+ | > Q.「ニコニコ春画」とはなんですか? | ||
+ | > A. | ||
+ | > ニコニコ静画のイラストコーナー内にあるサービスです。「ニコニコ春画」では、投稿時にR-15カテゴリが設定されたイラストや、過度に性的・過激な表現が含まれると判断されたイラストが掲載されます。 | ||
+ | |||
+ | 另见:[[atwiki> | ||
+ | |||
+ | ===== 列出 img_id ===== | ||
+ | |||
+ | '' | ||
+ | |||
+ | 遍历 page 拿到所有 shunga 的 img_id (seiga_id)。 | ||
+ | |||
+ | ===== 缩略图 ===== | ||
+ | |||
+ | Shunga 的缩略图没有任何访问限制,随便跑128并发。 | ||
+ | |||
+ | '' | ||
+ | |||
+ | size 为 '' | ||
+ | |||
+ | ===== 原图 ===== | ||
+ | |||
+ | 需要带登录 Cookies 以及 jp ip 访问 | ||
+ | |||
+ | '' | ||
+ | |||
+ | 访问后会被 30X 到类似 '' | ||
+ | |||
+ | 这个页面是用一个叫 illust_view_big 的 div 来显示原图的。 | ||
+ | |||
+ | <code html5> | ||
+ | <div class=" | ||
+ | data-src="< | ||
+ | data-watch_url="< | ||
+ | ></ | ||
+ | </ | ||
+ | |||
+ | 把页面 URL 中的 '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | ===== PC 详情页 ===== | ||
+ | |||
+ | '' | ||
+ | |||
+ | ===== Zeno Patches ===== | ||
+ | |||
+ | bug1: Zeno v1 的 '' | ||
+ | |||
+ | <code diff> | ||
+ | diff --git a/ | ||
+ | index 0e7308c8..3e6fc594 100644 | ||
+ | --- a/ | ||
+ | +++ b/ | ||
+ | @@ -207,6 +207,14 @@ func (c *Crawl) Capture(item *queue.Item) error { | ||
+ | req.Header.Set(" | ||
+ | } | ||
+ | |||
+ | + // apply c.Client.Jar to request | ||
+ | + if c.Client.Jar != nil { | ||
+ | + | ||
+ | + for _, cookie := range c.Client.Jar.Cookies(item.URL) { | ||
+ | + | ||
+ | + } | ||
+ | + } | ||
+ | + | ||
+ | req.Header.Set(" | ||
+ | |||
+ | // Execute site-specific code on the request, before sending it | ||
+ | </ | ||
+ | |||
+ | Zeno v1 的通用外链提取器没有覆盖到 div: | ||
+ | |||
+ | <code diff> | ||
+ | diff --git a/ | ||
+ | index 9aaa90eb..87f7a157 100644 | ||
+ | --- a/ | ||
+ | +++ b/ | ||
+ | @@ -232,6 +232,24 @@ func (c *Crawl) extractAssets(base *url.URL, item *queue.Item, | ||
+ | } | ||
+ | }) | ||
+ | |||
+ | + // | ||
+ | + // | ||
+ | + // | ||
+ | + // | ||
+ | + if !utils.StringInSlice(" | ||
+ | + | ||
+ | + | ||
+ | + if exists { | ||
+ | + | ||
+ | + } | ||
+ | + | ||
+ | + // dataWatchURL, | ||
+ | + // if exists { | ||
+ | + // | ||
+ | + // } | ||
+ | + }) | ||
+ | + } | ||
+ | + | ||
+ | // Extract assets on the page (images, scripts, videos..) | ||
+ | if !utils.StringInSlice(" | ||
+ | doc.Find(" | ||
+ | </ | ||
+ | |||
+ | 对 /priv/ 的图链做全局限速。 | ||
+ | |||
+ | <code diff> | ||
+ | diff --git a/ | ||
+ | index 9aaa90eb..fd13eabd 100644 | ||
+ | --- a/ | ||
+ | +++ b/ | ||
+ | @@ -20,9 +20,26 @@ import ( | ||
+ | var backgroundImageRegex = regexp.MustCompile(`(?: | ||
+ | var urlRegex = regexp.MustCompile(`(? | ||
+ | |||
+ | +var NicoNicoLock = & | ||
+ | +var LastNicoNicoArchivedAt = time.Now() | ||
+ | + | ||
+ | +const RATE_LIMIT_NICONICO = time.Duration(6 * time.Second) | ||
+ | + | ||
+ | func (c *Crawl) captureAsset(item *queue.Item, | ||
+ | var resp *http.Response | ||
+ | |||
+ | + if niconico.IsLohasImagePrivUrl(utils.URLToString(item.URL)) { | ||
+ | + | ||
+ | + | ||
+ | + if timeToSleepDuration > 0 { | ||
+ | + | ||
+ | + | ||
+ | + } | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + } | ||
+ | + | ||
+ | // Prepare GET request | ||
+ | req, err := http.NewRequest(" | ||
+ | if err != nil { | ||
+ | </ | ||
+ | |||
+ | ===== 存档过程 ===== | ||
+ | |||
+ | 遍历得到大概 114500+ 个 img_id,先把缩略图存了。 | ||
+ | |||
+ | [[IA> | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | 由于原图有 rate-limit ,算下来单机跑需要 (114500*6)/ | ||
+ | |||
+ | 翻了一会儿,发现 Gcore 卖非常便宜的按小时收费的 JP VPS,于是开了 7 台 (加上群友的两台 vultr JP),每台都加进 tailscale,然后按顺序从 {1..9} 设 IP,然后 sing-box 各自在 7690 端口上开个 socks 代理。 | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt update | ||
+ | sudo apt install curl htop tmux -y | ||
+ | |||
+ | # curl < | ||
+ | |||
+ | curl -fsSL < | ||
+ | |||
+ | sudo curl -fsSL < | ||
+ | sudo chmod a+r / | ||
+ | echo "deb [arch=`dpkg --print-architecture` signed-by=/ | ||
+ | sudo tee / | ||
+ | sudo apt-get update | ||
+ | sudo apt-get install sing-box # or sing-box-beta | ||
+ | |||
+ | hostname | ||
+ | echo "PLS setting IP!!!" | ||
+ | read | ||
+ | |||
+ | tailscale_ip=$(tailscale ip --4) | ||
+ | |||
+ | # 检查 tailscale ip 命令是否成功执行 | ||
+ | if [[ -z " | ||
+ | echo " | ||
+ | tailscale_ip=" | ||
+ | fi | ||
+ | |||
+ | # 构建 JSON 字符串,然后写入文件 | ||
+ | printf '{ | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | }' " | ||
+ | |||
+ | # 检查写入是否成功 | ||
+ | if [[ $? -eq 0 ]]; then | ||
+ | echo " | ||
+ | else | ||
+ | echo " | ||
+ | fi | ||
+ | |||
+ | sudo systemctl enable sing-box && sudo systemctl restart sing-box.service | ||
+ | # 让 gemini 写的 | ||
+ | </ | ||
+ | |||
+ | 在主服务器上起 9 个 Zeno,绑到这 9 个 socks 上。最终花费一天的时间搞定,仅花费1欧元。 | ||
+ | |||
+ | 中间被 Gcore 的防火墙坑了,它那防火墙甚至能影响绑定在 tailscale interface 里的 socks 出站,导致 socks 无法将外网的 http response 发回 tailscale 另一端的 socks client,会 conn reset,非常神奇。 | ||
+ | |||
+ | https:// | ||
+ | |||
+ | (一开始在单机跑,所以 IA 上有 10 个 item) | ||
+ | |||
+ | 详情页是关站前一天爬的,中途 OOM 了一次,如果 Zeno 的手搓 WAL 没出问题的话,应该也许大概没丢数据。 | ||
+ | |||
+ | [[IA> |