Nền tảng đấu giá bảo vệ dữ liệu danh sách và chức năng tìm kiếm với reCAPTCHA v2. CAPTCHA xuất hiện thường xuyên nhất trong các truy vấn tìm kiếm nhanh, chế độ xem chi tiết danh sách và tra cứu lịch sử giá thầu. Sau đây là cách duy trì hoạt động giám sát đáng tin cậy trên các trang web đấu giá.
Nơi kích hoạt CAPTCHA trên các trang web đấu giá
| hành động | loại CAPTCHA | Mẫu kích hoạt |
|---|---|---|
| Search/browse danh sách | reCAPTCHA v2 | Tìm kiếm tuần tự nhanh chóng |
| Xem chi tiết danh sách | reCAPTCHA v2 | Âm lượng lớn từ cùng một IP |
| Kiểm tra lịch sử giá thầu | reCAPTCHA v2 | Tải trang chi tiết lặp đi lặp lại |
| Duyệt danh mục | Cloudflare Turnstile | Tốc độ điều hướng giống như bot |
| Các trang thông báo giá | reCAPTCHA v2 | Làm mới thường xuyên |
Giám sát đấu giá bằng cách giải CAPTCHA
import requests
import time
import re
from datetime import datetime
class AuctionMonitor:
def __init__(self, api_key):
self.api_key = api_key
self.session = requests.Session()
self.session.headers.update({
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
})
def search_listings(self, auction_url, query, category=None):
"""Search auction listings, solving CAPTCHAs when triggered."""
params = {"q": query}
if category:
params["category"] = category
response = self.session.get(
f"{auction_url}/search", params=params
)
if self._has_captcha(response.text):
site_key = self._extract_site_key(response.text)
token = self._solve_recaptcha(site_key, f"{auction_url}/search")
response = self.session.post(
f"{auction_url}/search",
data={**params, "g-recaptcha-response": token}
)
return self._parse_listings(response.text)
def monitor_listing(self, auction_url, listing_id):
"""Get current bid and listing details."""
url = f"{auction_url}/item/{listing_id}"
response = self.session.get(url)
if self._has_captcha(response.text):
site_key = self._extract_site_key(response.text)
token = self._solve_recaptcha(site_key, url)
response = self.session.post(url, data={
"g-recaptcha-response": token
})
return self._parse_listing_detail(response.text)
def track_bids(self, auction_url, listing_ids, interval=60):
"""Track bid changes across multiple listings."""
history = {lid: [] for lid in listing_ids}
while True:
for listing_id in listing_ids:
try:
detail = self.monitor_listing(auction_url, listing_id)
previous = history[listing_id]
if previous and detail["current_bid"] != previous[-1]["current_bid"]:
print(f"Bid change on {listing_id}: "
f"${previous[-1]['current_bid']} → ${detail['current_bid']}")
history[listing_id].append(detail)
except Exception as e:
print(f"Error checking {listing_id}: {e}")
time.sleep(interval)
def _has_captcha(self, html):
return "g-recaptcha" in html or "recaptcha" in html.lower()
def _extract_site_key(self, html):
match = re.search(r'data-sitekey="([^"]+)"', html)
if match:
return match.group(1)
match = re.search(r"sitekey['\"]?\s*[:=]\s*['\"]([^'\"]+)", html)
if match:
return match.group(1)
raise ValueError("Could not find reCAPTCHA site key")
def _solve_recaptcha(self, site_key, page_url):
resp = requests.post("https://ocr.captchaai.com/in.php", data={
"key": self.api_key,
"method": "userrecaptcha",
"googlekey": site_key,
"pageurl": page_url,
"json": 1
})
task_id = resp.json()["request"]
for _ in range(60):
time.sleep(3)
result = requests.get("https://ocr.captchaai.com/res.php", params={
"key": self.api_key,
"action": "get",
"id": task_id,
"json": 1
})
data = result.json()
if data["status"] == 1:
return data["request"]
raise TimeoutError("reCAPTCHA solve timed out")
def _parse_listings(self, html):
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
def text_or_none(node):
return node.text.strip() if node and node.text else None
def attr_or_none(node, attr):
return node.get(attr) if node else None
listings = []
for item in soup.select(".listing-item, .auction-item"):
listings.append({
"title": text_or_none(item.select_one(".title")),
"current_bid": text_or_none(item.select_one(".price, .bid")),
"time_left": text_or_none(item.select_one(".time-left")),
"url": attr_or_none(item.select_one("a"), "href")
})
return listings
def _parse_listing_detail(self, html):
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, "html.parser")
def text_or_none(node):
return node.text.strip() if node and node.text else None
return {
"title": text_or_none(soup.select_one("h1, .item-title")),
"current_bid": text_or_none(soup.select_one(".current-bid, .price")),
"bid_count": text_or_none(soup.select_one(".bid-count")),
"time_left": text_or_none(soup.select_one(".time-remaining")),
"checked_at": datetime.now().isoformat()
}
# Usage
monitor = AuctionMonitor("YOUR_API_KEY")
listings = monitor.search_listings(
"https://auctions.example.com",
"vintage electronics",
category="collectibles"
)
Hệ thống cảnh báo giá (JavaScript)
class AuctionTracker {
constructor(apiKey) {
this.apiKey = apiKey;
this.watchList = new Map();
}
addWatch(listingId, url, maxPrice) {
this.watchList.set(listingId, { url, maxPrice, history: [] });
}
async checkAll() {
const alerts = [];
for (const [id, watch] of this.watchList) {
try {
const detail = await this.fetchListing(watch.url);
watch.history.push(detail);
const price = parseFloat(detail.currentBid.replace(/[^0-9.]/g, ''));
if (price >= watch.maxPrice * 0.9) {
alerts.push({
listing: id,
price,
threshold: watch.maxPrice,
message: `Price approaching limit: $${price} / $${watch.maxPrice}`
});
}
} catch (error) {
alerts.push({ listing: id, error: error.message });
}
}
return alerts;
}
async fetchListing(url) {
const response = await fetch(url);
const html = await response.text();
if (html.includes('g-recaptcha')) {
return this.solveAndFetch(url, html);
}
return this.parseDetail(html);
}
async solveAndFetch(url, html) {
const siteKeyMatch = html.match(/data-sitekey="([^"]+)"/);
if (!siteKeyMatch) throw new Error('No reCAPTCHA site key found');
const submitResp = await fetch('https://ocr.captchaai.com/in.php', {
method: 'POST',
body: new URLSearchParams({
key: this.apiKey,
method: 'userrecaptcha',
googlekey: siteKeyMatch[1],
pageurl: url,
json: '1'
})
});
const { request: taskId } = await submitResp.json();
for (let i = 0; i < 60; i++) {
await new Promise(r => setTimeout(r, 3000));
const result = await fetch(
`https://ocr.captchaai.com/res.php?key=${this.apiKey}&action=get&id=${taskId}&json=1`
);
const data = await result.json();
if (data.status === 1) {
// Resubmit with token
const response = await fetch(url, {
method: 'POST',
body: new URLSearchParams({ 'g-recaptcha-response': data.request })
});
return this.parseDetail(await response.text());
}
}
throw new Error('reCAPTCHA solve timed out');
}
parseDetail(html) {
// Parse auction listing details from HTML
return {
currentBid: html.match(/current.?bid[^>]*>([^<]+)/i)?.[1]?.trim(),
bidCount: html.match(/(\d+)\s*bids?/i)?.[1],
timeLeft: html.match(/time.?(?:left|remaining)[^>]*>([^<]+)/i)?.[1]?.trim(),
checkedAt: new Date().toISOString()
};
}
}
// Usage
const tracker = new AuctionTracker('YOUR_API_KEY');
tracker.addWatch('item-123', 'https://auctions.example.com/item/123', 500);
tracker.addWatch('item-456', 'https://auctions.example.com/item/456', 200);
const alerts = await tracker.checkAll();
Chiến lược giám sát
| Kiểm tra tần suất | Trường hợp sử dụng | Tỷ lệ CAPTCHA dự kiến |
|---|---|---|
| Cứ sau 30 giây | Đấu giá phút chót | Cao – sử dụng proxy |
| Cứ sau 5 phút | Theo dõi đấu giá tích cực | Trung bình |
| Cứ sau 15 phút | Giám sát danh sách theo dõi | Thấp |
| Mỗi giờ | Nghiên cứu giá dài hạn | Tối thiểu |
Giảm tần suất CAPTCHA
| Kỹ thuật | tác động |
|---|---|
| Tái sử dụng cookie phiên | Duy trì trạng thái xác thực |
| Xoay đa dạng nguồn yêu cầu | Phân phối yêu cầu trên các IP |
| Ngẫu nhiên hóa khoảng thời gian yêu cầu | Tránh các mẫu phát hiện định kỳ |
| Sử dụng tài khoản được xác thực | Ngưỡng kích hoạt CAPTCHA thấp hơn |
Khắc phục sự cố
| Vấn đề | Nguyên nhân | Cách xử lý |
|---|---|---|
| CAPTCHA theo mọi yêu cầu | Không có phiên kiên trì | Tái sử dụng requests.Session() |
| mã thông báo reCAPTCHA bị từ chối | Mã thông báo đã hết hạn (thời gian tồn tại 2 phút) | Giải quyết ngay trước khi nộp |
| Trang danh sách hiển thị 0 kết quả | Kết quả được lọc âm thầm CAPTCHA | Kiểm tra các phần tử CAPTCHA ẩn |
| IP bị chặn sau nhiều CAPTCHA | Đã vượt quá giới hạn tỷ lệ | Xoay proxy, tăng khoảng thời gian |
Câu hỏi thường gặp
Tôi có thể kiểm tra danh sách đấu giá nhanh như thế nào?
CaptchaAI giải quyết reCAPTCHA v2 trong 10–30 giây. Đối với các phiên đấu giá nhạy cảm về thời gian, hãy giải quyết trước mã thông báo và xoay vòng proxy để giảm thiểu độ trễ.
Các trang web đấu giá sẽ phát hiện giám sát?
Việc phát hiện phụ thuộc vào mẫu yêu cầu chứ không phải việc giải CAPTCHA. Sử dụng khoảng thời gian thực tế, luân chuyển tác nhân người dùng và tránh thu thập thông tin trong những giờ có lưu lượng truy cập thấp khi yêu cầu của bạn nổi bật.
Tôi có thể theo dõi các cuộc đấu giá trực tiếp trong thời gian thực không?
Trong những phút cuối cùng của cuộc đấu giá, hãy sử dụng tính năng tự động hóa của trình duyệt với các phiên được xác thực trước để giảm thiểu việc gặp phải CAPTCHA. Tốc độ của CaptchaAI xử lý mọi CAPTCHA vẫn xuất hiện.
bài viết liên quan
- Cách giải quyết cuộc gọi lại Recaptcha V2 bằng Api
- Xử lý cửa quay Recaptcha V2 trên cùng một trang web
- Cơ chế gọi lại Recaptcha V2
Các bước tiếp theo
Giám sát các cuộc đấu giá một cách đáng tin cậy —lấy khóa API CaptchaAI của bạnvà tự động giải quyết các thử thách reCAPTCHA v2.