chore: 移除临时测试脚本
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
import time
|
|
||||||
import app.plugins
|
|
||||||
from app.services.plugin_service import PluginService
|
|
||||||
|
|
||||||
async def main():
|
|
||||||
svc = PluginService()
|
|
||||||
start = time.time()
|
|
||||||
results = await svc.run_all_plugins()
|
|
||||||
elapsed = time.time() - start
|
|
||||||
print(f"Batch crawl completed in {elapsed:.2f}s")
|
|
||||||
print(f"Total unique proxies: {len(results)}")
|
|
||||||
from collections import Counter
|
|
||||||
c = Counter(p.protocol for p in results)
|
|
||||||
for proto, cnt in sorted(c.items()):
|
|
||||||
print(f" {proto}: {cnt}")
|
|
||||||
|
|
||||||
asyncio.run(main())
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
import app.plugins
|
|
||||||
from app.core.plugin_system.registry import registry
|
|
||||||
from app.core.log import logger
|
|
||||||
import logging
|
|
||||||
logger.setLevel(logging.WARNING)
|
|
||||||
|
|
||||||
async def test_plugin(p, timeout=20):
|
|
||||||
try:
|
|
||||||
proxies = await asyncio.wait_for(p.crawl(), timeout=timeout)
|
|
||||||
return len(proxies), proxies[:1] if proxies else []
|
|
||||||
except asyncio.TimeoutError:
|
|
||||||
return -2, []
|
|
||||||
except Exception as e:
|
|
||||||
return -1, [str(e)]
|
|
||||||
|
|
||||||
async def test_all():
|
|
||||||
plugins = registry.list_plugins()
|
|
||||||
print(f'Total plugins: {len(plugins)}')
|
|
||||||
results = {}
|
|
||||||
for p in plugins:
|
|
||||||
print(f'Testing {p.name} (timeout=20s)...', flush=True)
|
|
||||||
count, sample = await test_plugin(p, timeout=20)
|
|
||||||
results[p.name] = count
|
|
||||||
if count > 0:
|
|
||||||
print(f' -> OK: {count} proxies, sample={sample[0]}')
|
|
||||||
elif count == 0:
|
|
||||||
print(f' -> EMPTY')
|
|
||||||
elif count == -2:
|
|
||||||
print(f' -> TIMEOUT')
|
|
||||||
else:
|
|
||||||
print(f' -> ERROR: {sample[0]}')
|
|
||||||
|
|
||||||
print('\n' + '='*50)
|
|
||||||
print('SUMMARY:')
|
|
||||||
for name, count in sorted(results.items()):
|
|
||||||
if count > 0:
|
|
||||||
status = 'OK'
|
|
||||||
elif count == 0:
|
|
||||||
status = 'EMPTY'
|
|
||||||
elif count == -2:
|
|
||||||
status = 'TIMEOUT'
|
|
||||||
else:
|
|
||||||
status = 'ERROR'
|
|
||||||
print(f' {name:22s} {status:8s} ({count} proxies)')
|
|
||||||
|
|
||||||
asyncio.run(test_all())
|
|
||||||
Reference in New Issue
Block a user