Files
html/api/sd.php
2026-04-12 22:57:03 +02:00

8 lines
438 B
PHP

<?php
if(($_GET['k']??'')!=='WEVADS2026') die('auth');
$project="/opt/weval-scrapy";
$spider=$_GET["spider"]??"site_monitor";
$out=shell_exec("cd $project && timeout 30 python3 -m scrapy crawl $spider -o /tmp/scrapy-debug.json -t json 2>&1");
$items=@json_decode(@file_get_contents("/tmp/scrapy-debug.json"),true)?:[];
echo json_encode(["spider"=>$spider,"items"=>count($items),"data"=>array_slice($items,0,5),"log"=>substr($out,-500)]);