1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| public function getlist(){ $url="https://store.steampowered.com/search/?filter=topsellers&l=schinese"; $rules = [ 'image' => ['div.col.search_capsule > img','src'], 'title'=> ['div.col.search_name.ellipsis > span.title','text'], 'appid'=>['','data-ds-appid'], 'bundleid'=>['','data-ds-bundleid'], 'time'=>['div.col.search_released.responsive_secondrow','text'], 'ori_price'=>['div.col.search_price.responsive_secondrow > span > strike','text'], 'now_price'=>['div.col.search_price.responsive_secondrow','text','-span'], 'discount'=>['div.col.search_discount.responsive_secondrow > span','text'], ]; $range = '#search_resultsRows a'; $rt = QueryList::get($url)->rules($rules)->range($range)->query()->getData(); return success('success', $rt); }
public function search(){ $keyword=input('keyword'); $url="https://store.steampowered.com/search/?term=$keyword&l=schinese"; $rules = [ 'image' => ['div.col.search_capsule > img','src'], 'title'=> ['div.col.search_name.ellipsis > span.title','text'], 'appid'=>['','data-ds-appid'], 'bundleid'=>['','data-ds-bundleid'], 'time'=>['div.col.search_released.responsive_secondrow','text'], 'ori_price'=>['div.col.search_price.responsive_secondrow > span > strike','text'], 'now_price'=>['div.col.search_price.responsive_secondrow','text','-span'], 'discount'=>['div.col.search_discount.responsive_secondrow > span','text'], ]; $range = '#search_resultsRows a'; $rt = QueryList::get($url)->rules($rules)->range($range)->query()->getData(); return success('success', $rt); } public function getdetail(){ $appid=input('appid'); $url="https://store.steampowered.com/app/$appid/_/"; $ql=QueryList::get($url,['l'=>'schinese'],['headers' => ['Cookie'=> 'wants_mature_content=1;birthtime=786211201']]); $rules = [ 'name' => ['div#appHubAppName','text'], 'description'=> ['div.game_description_snippet','text'], 'summary'=>['span.nonresponsive_hidden','text','',function($item){ return str_replace(["\t","\n","\r"],['','',''],$item); }], 'date'=>['div.release_date >div.date','text'], 'tag'=>['a.app_tag','text','',function($item){ return str_replace(["\t","\n","\r"],['','',','],$item); }], 'image'=>['img.game_header_image_full','src'], 'preview'=>['a.highlight_screenshot_link','attrs(href)','',function($item){ return str_replace(['https://steamcommunity.com/linkfilter/?url=','1920x1080'],['','600x338'],$item); }], 'videos'=>['div.highlight_player_item.highlight_movie','attrs(data-poster)'] ]; $rt = $ql->rules($rules)->query()->getData(); return success('success',$rt); }
|