Web Scraping Và Pháp Lý: Những Điều Cần Biết
Web scraping có thể gây ra vấn đề pháp lý nếu không cẩn thận. Bài viết giải thích các khía cạnh pháp lý của scraping.
Disclaimer
⚠️ Đây là thông tin chung, không phải tư vấn pháp lý. Hãy tham khảo luật sư khi cần.
Các Vấn Đề Pháp Lý Phổ Biến
- Terms of Service: Vi phạm điều khoản sử dụng
- Copyright: Sao chép nội dung có bản quyền
- CFAA (US): Computer Fraud and Abuse Act
- GDPR (EU): Thu thập dữ liệu cá nhân
- Trespass: Truy cập trái phép
Case Studies Quan Trọng
hiQ vs LinkedIn (2022)
- hiQ scrape public LinkedIn profiles
- Tòa án phán quyết: Scrape public data = hợp pháp
- Key takeaway: Public data có thể scrape
Clearview AI
- Scrape billions of faces từ social media
- Bị phạt nặng ở EU, Australia
- Key takeaway: Biometric data rất nhạy cảm
Nguyên Tắc An Toàn
1. Chỉ Scrape Public Data
# OK: Public product pages
scrape('https://shop.com/products')
# RISKY: Behind login
scrape('https://shop.com/user/orders') # Cần permission
2. Respect robots.txt
import urllib.robotparser
rp = urllib.robotparser.RobotFileParser()
rp.set_url('https://example.com/robots.txt')
rp.read()
if rp.can_fetch('*', '/products/'):
scrape('/products/')
else:
print("Blocked by robots.txt")
3. Đọc Terms of Service
- Nhiều sites cấm scraping trong ToS
- Vi phạm ToS có thể bị kiện
- Một số courts coi ToS như contract
4. Không Gây Hại Cho Server
# Good: Respectful rate limiting
import time
for url in urls:
scrape(url)
time.sleep(2) # Don't overwhelm server
# Bad: DDoS-like behavior
# Thousands of requests per second
5. Xử Lý Dữ Liệu Cá Nhân Cẩn Thận
- GDPR áp dụng cho EU citizens
- Không collect PII không cần thiết
- Có legal basis cho processing
- Implement data retention policies
Best Practices
- ✅ Scrape public data only
- ✅ Respect robots.txt
- ✅ Rate limit requests
- ✅ Identify yourself (User-Agent)
- ✅ Don’t republish copyrighted content
- ✅ Store data securely
- ❌ Don’t bypass authentication
- ❌ Don’t overload servers
- ❌ Don’t collect sensitive PII
Khi Nào Cần Permission
- Scraping at massive scale
- Commercial use of data
- Collecting personal information
- Accessing behind login
VinaProxy + Ethical Scraping
- Scrape responsibly với rate limiting
- Residential IPs cho respectful access
- Giá chỉ $0.5/GB
