按商店拆分商品目录
每家商店有自己的请求队列和自己那份代理列表。大型电商平台分到的份额最大。
追踪程序每小时访问同样的页面。被封的正是这种模式,代理池要把它藏起来。
每次访问同一商品都换一个 IP
4 号套餐有 30,000 个地址:同一商品页一个月才会碰到同一个 IP 一次
看到本地买家看到的价格
欧洲、独联体、中国代理池;美国及其他市场用全球混合
每小时检查数千个 SKU
4 号套餐最多 2,500 线程,6 号套餐 5,000
抓带图片和脚本的完整页面,而不只是 JSON
不限流量:按计划需要多频繁就抓多频繁
每小时一万个 SKU,3 号套餐就够;要监控整个电商平台,需要 4 号或更大的套餐。
每家商店有自己的请求队列和自己那份代理列表。大型电商平台分到的份额最大。
每个请求取下一个地址,失败时换地址重试两次,记录价格时连同取回它的 IP 一起保存。
地址变旧后会离开代理池。链接总是返回当前的地址集,所以用定时器重新读取。
在 products.txt 中填入商品 URL,设置 COUNTRY。每个商品都通过下一个代理抓取,提取价格后写入 prices.csv。请根据商店的页面结构调整 PRICE_RE。可以先在免费代理列表上试跑。
#!/usr/bin/env python3
"""Price monitor for Advanced.name proxies.
Fetches product pages through proxies from the buyer's country and pulls the
price out of each page. One request per product goes through the next proxy, so
a shop sees the same address rarely. Standard library only. python3 prices.py
"""
# ================================ CONFIG ====================================
CSV_URL = "https://get.advanced.name/YOUR_LIST_ID.csv" # CSV export link from your dashboard
COUNTRY = "DE" # buyers' country: prices are read as local shoppers see them
MIN_SPEED = 3
PRODUCTS_FILE = "products.txt" # one product URL per line
PRICE_RE = r'"price"\s*:\s*"?([0-9][0-9.,]*)' # regex, group 1 = the price
OUT_FILE = "prices.csv" # url;price;proxy;country is written here
THREADS = 40
TIMEOUT = 20
RETRIES = 3
# ============================================================================
import csv
import io
import itertools
import re
import sys
import threading
import urllib.request
from concurrent.futures import ThreadPoolExecutor, as_completed
COL_IP, COL_PORT, COL_COUNTRY, COL_SPEED = 0, 1, 2, 3
UA = "Mozilla/5.0 (compatible; price-monitor/1.0)"
PRICE = re.compile(PRICE_RE)
def load_proxies():
raw = urllib.request.urlopen(CSV_URL, timeout=30).read().decode("utf-8", "replace")
pool = []
for row in csv.reader(io.StringIO(raw), delimiter=";"):
if len(row) <= COL_SPEED or not row[COL_PORT].strip().isdigit():
continue
if COUNTRY and row[COL_COUNTRY].strip().upper() != COUNTRY.upper():
continue
if int(row[COL_SPEED] or 0) < MIN_SPEED:
continue
pool.append(row[COL_IP].strip() + ":" + row[COL_PORT].strip())
return pool
def main():
proxies = load_proxies()
if not proxies:
sys.exit("No proxies for COUNTRY=%r." % COUNTRY)
with open(PRODUCTS_FILE, encoding="utf-8") as fh:
products = [line.strip() for line in fh if line.strip() and not line.startswith("#")]
print("proxies: %d (%s), products: %d" % (len(proxies), COUNTRY, len(products)))
rotation = itertools.cycle(proxies)
lock = threading.Lock()
def grab(url):
for _ in range(RETRIES):
with lock:
proxy = next(rotation)
handler = urllib.request.ProxyHandler({"http": "http://" + proxy, "https": "http://" + proxy})
req = urllib.request.Request(url, headers={
"User-Agent": UA, "Accept-Language": COUNTRY.lower() + "," + COUNTRY.upper()})
try:
html = urllib.request.build_opener(handler).open(req, timeout=TIMEOUT).read().decode("utf-8", "replace")
except Exception:
continue
match = PRICE.search(html)
return (match.group(1) if match else "not found"), proxy
return "unreachable", ""
rows = []
with ThreadPoolExecutor(max_workers=THREADS) as pool:
futures = {pool.submit(grab, u): u for u in products}
for fut in as_completed(futures):
url = futures[fut]
price, proxy = fut.result()
rows.append((url, price, proxy, COUNTRY))
print("%-9s %s" % (price, url[:60]))
with open(OUT_FILE, "w", encoding="utf-8", newline="") as out:
writer = csv.writer(out, delimiter=";")
writer.writerow(["url", "price", "proxy", "country"])
writer.writerows(rows)
print("written %s (%d rows)" % (OUT_FILE, len(rows)))
if __name__ == "__main__":
main()
每个商品页都通过下一个代理抓取,从 JSON-LD 块或价格节点中取价格;上面的脚本用的是按商店调整的正则表达式。使用本地 IP 时同时发送该地区的 Accept-Language 和货币 Cookie,否则商店可能把你转到别的市场。
按压力排计划:库存每小时一次,价格每天两次。每个价格都保存 HTTP 状态码,这样某家商店连续出现 403 时,你就知道只需在那里放慢。
价格监控服务和无代码爬虫(Octoparse、Web Scraper)都能在设置里填代理列表:粘贴同一个 ip:port 文件即可。就连 Google Sheets 的 IMPORTXML 也能通过小型代理中转做轻量检查。



每小时巡检一次商品目录,用不限流量套餐最划算。防护严格的商店和城市价格需要住宅地址。
每小时巡检目录最佳选择
每小时检查时,一个商品页大约一个月才会再次遇到同一个IP。完整页面不会增加费用。
$990 每月或每小时$4.20
严格的商店
每次请求都用商店所在国家的家庭IP。适用于对列表地址显示验证码而不显示价格的网站。
低至 $0.49 每GB1GB仅需$0.85
城市价格
在连接字符串中设置城市和地区。商店会显示该城市买家看到的价格和配送信息。
低至 $1.39 每GB1GB仅需$2.29