getActiveSheet(); $sheet->setTitle($title); $sheet->fromArray($apps); $writer = new Xlsx($spreadsheet); $writer->save('/www/ai/'.$title.".xlsx"); $spreadsheet->disconnectWorksheets(); } catch (\PhpOffice\PhpSpreadsheet\Exception $e) { } function getPages($catid,$page){ echo "正在处理:$catid\t$page".PHP_EOL; $url="https://www.wandoujia.com/wdjweb/api/category/more?catId={$catid}&subCatId=0&page=$page&ctoken=35CLqdFYoYWt80ByPrajl22L"; $html=json_decode(file_get_contents($url),true)['data']['content']; return getListByHtml($html); } function getListByHtml($html){ $rules = array ( 'title' => array ( 0 => 'h2>a', 1 => 'text', ), 'link' => array ( 0 => 'h2>a', 1 => 'href', ), ); $data=(new QL\QueryList)->html($html)->rules($rules)->range('.card')->queryData(); foreach ($data as &$datum) { preg_match("/\d+/",$datum['link'],$appid); $appid=$appid[0]; $datum['down_url']="https://www.wandoujia.com/apps/{$appid}/download/dot?ch=detail_normal_dl"; } return $data; } function getFirstAppList($url){ $rules = array ( 'title' => array ( 0 => 'h2>a', 1 => 'text', ), 'link' => array ( 0 => 'h2>a', 1 => 'href', ), ); $data = QueryList::get($url)->rules($rules)->range('.app-box>.card')->queryData(); return $data; } function getList(){ $data = (new QL\QueryList)->get('https://www.wandoujia.com/category/app?pos=w/crumb/appcategory')->find('.cate-link')->attrs('href'); return $data->all(); }