Python feapder & ScrapySplash Tunnel Proxy: Framework Extensions
feapder AirSpider and Scrapy+Splash integrating 16Yun Crawler Proxy.
16Yun Engineering TeamMay 11, 20261 min read
feapder: Lightweight Crawler Framework
feapder is a lightweight Python crawler framework, configuring proxies via the download_midware method.
import os, feapder
class DemoSpider(feapder.AirSpider):
def start_requests(self):
yield feapder.Request("https://httpbin.org/ip")
def download_midware(self, request):
host = os.getenv("PROXY_HOST", "t.16yun.cn")
port = os.getenv("PROXY_PORT", "31111")
user = os.getenv("PROXY_USERNAME", "user")
pwd = os.getenv("PROXY_PASSWORD", "password")
request.proxies = {
"http": f"http://{user}:{pwd}@{host}:{port}",
"https": f"http://{user}:{pwd}@{host}:{port}",
}
return request
def parse(self, request, response):
print(response.text)
if __name__ == "__main__":
DemoSpider().start()| Scenario | feapder Implementation |
|---|---|
| A: Force Switch | feapder creates new connection per request by default |
| B: Keep IP | Reuse AirSpider instance (default) |
| C: Proxy-Tunnel | Add Proxy-Tunnel via request.headers |
ScrapySplash: JS-rendered Scraping
ScrapySplash renders JS via Splash and returns HTML. Proxy configuration is on the Splash side:
# settings.py
SPLASH_URL = "http://splash:8050"
SPLASH_PROXY = {
"host": os.getenv("PROXY_HOST", "t.16yun.cn"),
"port": int(os.getenv("PROXY_PORT", "31111")),
"username": os.getenv("PROXY_USERNAME", "user"),
"password": os.getenv("PROXY_PASSWORD", "password"),
}
DOWNLOADER_MIDDLEWARES = {
"scrapy_splash.SplashDeduplicateArgsMiddleware": 100,
}
DUPEFILTER_CLASS = "scrapy_splash.SplashAwareDupeFilter"Splash acts as an intermediate proxy layer, receiving browser rendering requests and forwarding to the crawler proxy:
Scrapy → Splash (JS rendering) → 16Yun Crawler Proxy → Target siteUse Case Comparison
| Framework | Use Case | Proxy Configuration |
|---|---|---|
| feapder | Lightweight, rapid development | download_midware injection |
| ScrapySplash | Pages requiring JS rendering | Configure upstream proxy on Splash side |
Need an enterprise proxy plan?
We can tailor architecture to your target domains, concurrency, and reliability goals.