切换到 “Profile” 选项卡,在对应配置文件上右键选择 “Parsers”,然后 “Edit Parsers”,添加下面的规则:
parsers:
- url: "<订阅URL>"
yaml:
prepend-rules:
- IP-CIDR,::/0,DIRECT
@NotNull | |
public SlidingWindowDynamicSpeedLimiter tweakSpeedLimiterBySlidingWindow(@Nullable String downloader, @NotNull DownloaderSpeedLimiter currentSetting, | |
long thresholdBytes, long minSpeedBytesPerSecond, long maxSpeedBytesPerSecond) throws Exception { | |
SlidingWindowDynamicSpeedLimiter slidingWindowDynamicSpeedLimiter = new SlidingWindowDynamicSpeedLimiter(); | |
slidingWindowDynamicSpeedLimiter.setThreshold(thresholdBytes); | |
slidingWindowDynamicSpeedLimiter.setMaxSpeed(maxSpeedBytesPerSecond); | |
slidingWindowDynamicSpeedLimiter.setMinSpeed(minSpeedBytesPerSecond); | |
// 假设滑动窗口为24小时 | |
long windowSizeMillis = 24 * 60 * 60 * 1000; // 24小时(毫秒) | |
slidingWindowDynamicSpeedLimiter.setWindowSizeMillis(windowSizeMillis); |
我正在使用 Java 23 编写爬虫,爬虫目标地址是: | |
https://archives.mcbbs.co/read.php?tid=<TID> | |
TID 是从 1 开始的整数,上不封顶 | |
当链接有效时,返回 200 状态码,并包含网页内容。此时你需要将整个页面存储到工作目录下的 archive 目录中的 <TID>.html 文件。 | |
特别注意的是,即使链接无效,也会返回 200 状态码,但内容固定为字符串 “ | |
文件不存在”。 | |
除此以外,我还要求并发爬取,但爬取速度不能超过 20req/s,并且 UserAgent 必须为:mcbbs-archives-indexer (@Ghost-chu [2908803755], speed 20req per seconds) | |
同时将所有有效链接存储到 archives/links.txt,一行一个 |
WITH LatestSnapshots AS ( | |
SELECT DISTINCT ON (s.torrent, s.peer_ip, s.user_application) | |
s.id, | |
s.torrent, | |
s.peer_ip, | |
s.user_application, | |
s.to_peer_traffic, | |
s.last_time_seen | |
FROM | |
public.peer_history s |
package com.ghostchu.peerbanhelper.downloader.impl.bitcomet.crypto; | |
import org.bouncycastle.jce.provider.BouncyCastleProvider; | |
import javax.crypto.Cipher; | |
import javax.crypto.Mac; | |
import javax.crypto.SecretKeyFactory; | |
import javax.crypto.spec.PBEKeySpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.io.ByteArrayOutputStream; |
## @NAME IPV6 ::1 Transmission 2.94 恶意多拨 | |
## @AUTHOR PBH-BTN Community | |
## @CACHEABLE true | |
## @VERSION 1.0 | |
## @THREADSAFE true | |
if(isBlank(peer.clientName)) { | |
return false; ## 下载器必须提供 ClientName | |
} |
## @NAME Gopeed 全随机检查 | |
## @AUTHOR PBH-BTN Community | |
## @CACHEABLE true | |
## @VERSION 1.1 | |
## @THREADSAFE true | |
if(isBlank(peer.clientName) || isBlank(peer.peerId)) { | |
return false; ## 二元组任意为空都不能继续检查,需要下载器支持 | |
} | |
## 全部转换为小写 |
## @NAME Gopeed 全随机检查 | |
## @AUTHOR PBH-BTN Community | |
## @CACHEABLE true | |
## @VERSION 1.0 | |
## @THREADSAFE true | |
if(isBlank(peer.clientName) || isBlank(peer.peerId)) { | |
return false; ## 二元组任意为空都不能继续检查,需要下载器支持 | |
} | |
## 全部转换为小写 |
切换到 “Profile” 选项卡,在对应配置文件上右键选择 “Parsers”,然后 “Edit Parsers”,添加下面的规则:
parsers:
- url: "<订阅URL>"
yaml:
prepend-rules:
- IP-CIDR,::/0,DIRECT
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
# Author: Sg4Dylan -- <sg4dylan#gmail.com> | |
# Licence: GPLv3 | |
import requests | |
import re | |
import json | |
import time |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.util.*; | |
import java.util.stream.Collectors; | |
public class Main { | |
public static void main(String[] args) { |