Web Scraping VPS Trên Offshore
Web scraping là kỹ thuật thu thập dữ liệu từ website tự động, được sử dụng cho price monitoring, market research, lead generation, content aggregation. Để scrape ở quy mô lớn mà không bị block, cần VPS với IP sạch chưa từng được dùng cho hoạt động malicious. VPS offshore Iceland của AnubizHost với IP châu Âu từ pool fresh phù hợp lý tưởng cho web scraping - không bị các anti-bot system như Cloudflare, DataDome, PerimeterX block ngay từ đầu như IP từ DigitalOcean, AWS, Hetzner đã bị flag.
Need this done for your project?
We implement, you ship. Async, documented, done in days.
Vì Sao IP VPS Quan Trọng Cho Scraping
Hầu hết các anti-bot system hiện đại (Cloudflare Bot Management, DataDome, PerimeterX/HUMAN, Akamai Bot Manager) sử dụng nhiều signal để phát hiện bot, nhưng signal đầu tiên và quan trọng nhất vẫn là IP address. Họ duy trì database khổng lồ về IP ranges của các cloud provider lớn (AWS, GCP, Azure, DigitalOcean, Hetzner, OVH) và automatically flag traffic từ những IP này là suspicious.
Hậu quả: scrape từ VPS AWS hay DigitalOcean thường bị block ngay sau request đầu tiên hoặc nhận captcha challenge liên tục. Tỷ lệ thành công có thể dưới 10%, làm việc scraping hầu như bất khả thi.
Giải pháp: dùng IP từ provider ít gặp hơn trong database anti-bot. VPS offshore Iceland của AnubizHost dùng IP range từ Iceland (Síminn, Vodafone Iceland) và Bắc Âu - không phải các cloud provider phổ biến. IP này thường được xếp loại "residential-like" hoặc neutral, không trigger flag tự động.
Tuy nhiên, IP chỉ là một yếu tố. Để scraping bền vững, cần kết hợp:
- IP sạch (VPS offshore + rotating residential proxy khi cần).
- Browser fingerprint hợp lệ (Playwright + stealth plugin).
- Behavior giống human (delay ngẫu nhiên, mouse movement, scroll).
- Respect robots.txt khi có thể (vừa hợp pháp vừa ít trigger flag).
Use case: e-commerce price monitoring (Amazon, Lazada, Shopee), SEO SERP tracking (Google, Bing), social media data (LinkedIn, X), real estate listing (Zillow), job posting (Indeed). Tất cả đều hợp pháp theo legal framework hiện hành nếu data là public.
Stack Scraping: Playwright/Puppeteer + Proxy Rotation
Stack scraping hiện đại điển hình: Playwright/Puppeteer (headless browser) + stealth plugin + proxy rotation + queue system. Cài đặt trên VPS Ubuntu:
apt update && apt install -y nodejs npm chromium
npm install playwright playwright-extra puppeteer-extra-plugin-stealth
npx playwright install chromium
Script scraping cơ bản:
const { chromium } = require('playwright-extra');
const stealth = require('puppeteer-extra-plugin-stealth')();
chromium.use(stealth);
(async () => {
const browser = await chromium.launch({
headless: true,
args: ['--no-sandbox', '--disable-blink-features=AutomationControlled']
});
const context = await browser.newContext({
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
viewport: { width: 1920, height: 1080 },
locale: 'en-US'
});
const page = await context.newPage();
await page.goto('https://example.com/target', { waitUntil: 'networkidle' });
const data = await page.evaluate(() => {
return document.querySelector('.product-price')?.innerText;
});
console.log(data);
await browser.close();
})();
Stealth plugin patch các fingerprint phổ biến mà anti-bot system check: navigator.webdriver, missing chrome runtime, plugin enumeration, languages, WebGL.
Proxy rotation: Cho scrape volume lớn (10k+ request/giờ), cần xoay IP. Các provider proxy residential reputable: Bright Data, Smartproxy, Oxylabs. Thay vào đó, kết hợp VPS offshore (IP base) với proxy rotation chỉ khi target có anti-bot mạnh.
const context = await browser.newContext({
proxy: {
server: 'http://proxy.host:8080',
username: 'USER',
password: 'PASS'
}
});
Queue system: Bull (Node.js) hoặc Celery (Python) quản lý queue request scrape. Worker drain queue ở rate controllable - tránh DoS target và tránh flag.
Vận Hành Scale, Pháp Lý và Đạo Đức
Scrape scale-up từ vài trăm request/ngày lên hàng triệu request/ngày cần thay đổi kiến trúc:
Distributed scraping: Một VPS không đủ - cần fleet 5-20 VPS, mỗi VPS xử lý subset của task. Coordinator (Redis-based queue) phân phối task, worker pull từ queue, push result vào database trung tâm (PostgreSQL hoặc S3-compatible storage offshore).
Failure handling: Mỗi request có thể fail vì timeout, 403, 503, captcha. Implement exponential backoff, retry tối đa 3 lần, log failure để analyze sau. Switch IP/proxy nếu fail rate spike trên một IP.
Anti-CAPTCHA: Khi gặp captcha không thể tránh, sử dụng 2Captcha hoặc Anti-Captcha service - họ trả lời captcha (image, recaptcha, hcaptcha) với phí $0.001-0.005/captcha. Tích hợp qua API.
Data storage: Result scrape có thể lên hàng GB/ngày. Lưu trong PostgreSQL với indexing tốt, hoặc S3-compatible (MinIO self-hosted, Backblaze B2). Compression (gzip JSON) tiết kiệm storage 70-80%.
Pháp lý:
- Scrape public data hợp pháp ở hầu hết jurisdictions (hiQ Labs v. LinkedIn 2022).
- Tránh scrape data có copyright và republish.
- Tránh scrape data đằng sau login (vi phạm ToS có thể bị civil suit).
- GDPR: nếu scrape data về EU citizen, cẩn thận về PII (personal identifiable information).
- Iceland location: pháp luật scrape rất permissive, không có luật anti-scraping specific.
Đạo đức:
- Respect robots.txt khi có thể.
- Rate limit hợp lý (1-5 req/giây thay vì 100/giây) để không ảnh hưởng target.
- Identify bot qua User-Agent custom (không giấu hoàn toàn).
- Provide opt-out: nếu webmaster contact bạn yêu cầu stop, dừng ngay.
Anubiz Host hỗ trợ scraping hợp pháp - chính sách ToS cho phép scrape public data, không cho phép DDoS, brute force, scrape data nhạy cảm violate copyright.
Related Services
Why Anubiz Host
Ready to get started?
Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.