request($this->CollectionUrl, $param); $parsedResult = json_decode($result, true); if(count(Arr::get($parsedResult, "favoriteList", [])) > 0) { foreach ($parsedResult["favoriteList"] as $item) { AcfunVideo::firstOrCreate(["content_id" => $item["contentId"]], [ "title" => $item["contentTitle"], "from_type" => 1, "from_collection_name" => "默认", "from_up_name" => $item["userName"], "from_up_user_id" => $item["userId"] ]); } } } } public function request($url, $param) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS =>$param, CURLOPT_HTTPHEADER => array( "authority: www.acfun.cn", "pragma: no-cache", "cache-control: no-cache", "accept: */*", "x-requested-with: XMLHttpRequest", "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36", "content-type: application/x-www-form-urlencoded; charset=UTF-8", "origin: https://www.acfun.cn", "sec-fetch-site: same-origin", "sec-fetch-mode: cors", "sec-fetch-dest: empty", "referer: https://www.acfun.cn/member/", "accept-language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6,ja;q=0.5", "cookie: _did=web_32586178239268B; sign_remind=1; ac__avi=1010934062045114530882ab2cd25b90ef370ea22b151084981cf6c2c6febafe3a364146315ef65213; uuid=d7fdb48c886459236faa794ffafbfbb0; analytics=GA1.2.626694313.1592365512; lsv_js_player_v2_main=62b719; csrfToken=TnNz3lG1IfA-93kw4M-Px06m; session_id=63965769975BFD30; webp_supported=%7B%22lossy%22%3Atrue%2C%22lossless%22%3Atrue%2C%22alpha%22%3Atrue%2C%22animation%22%3Atrue%7D; Hm_lvt_2af69bc2b378fb58ae04ed2a04257ed1=1592481541,1592489023,1592797550,1592976124; lsv_js_player_v1_main=f2c6e6; stochastic=NWFlaDB1ZjlmNXE%3D; acPasstoken=ChVpbmZyYS5hY2Z1bi5wYXNzdG9rZW4ScJrFeEdlHcrvoHjYpzy_V7pAPxxMhNmo45RlMccpB84XwmIx9rJocLwXSPnJu4btgtqVGa04P9AIMBNdQknDd4QRTbjBp5aoQgis-Q88BjMvqVTGHAjG04W7zjswa0ZC5k5sdJCeTsLJKEiEsE8EY90aEhwsbiM70HUviQANoYC6Iptv6yIg0X6u8ikzzwuDe1VMKWNNYXWwFR81YKYQNq9P4gsk5oMoBTAB; auth_key=572984; ac_username=Nicksxs; acPostHint=1cc641584039a19bc0941d00e8eff73bd4b0; ac_userimg=https%3A%2F%2Fimgs.aixifan.com%2Fstyle%2Fimage%2F201907%2FuQ5Vc06d3HSVTjY3VZocT81X40FByVpw.jpg; clientlanguage=zh_CN; safety_id=AAG%2B9AbVZS6fTHVxwLtsI9Jl; notice_status=1; online_status=0; userGroupLevel=1; checkMobile=1; checkEmail=1; cur_req_id=1296724223CA632E_self_0fb782b0474cbe335574779cf53ed145; cur_group_id=1296724223CA632E_self_0fb782b0474cbe335574779cf53ed145_0; Hm_lpvt_2af69bc2b378fb58ae04ed2a04257ed1=1592976174" ), )); $response = curl_exec($curl); curl_close($curl); return $response; } public function onlyRequest() { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://www.acfun.cn/rest/pc-direct/favorite/dougaList", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "perpage=100&page=1", CURLOPT_HTTPHEADER => array( "authority: www.acfun.cn", "pragma: no-cache", "cache-control: no-cache", "accept: */*", "x-requested-with: XMLHttpRequest", "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36", "content-type: application/x-www-form-urlencoded; charset=UTF-8", "origin: https://www.acfun.cn", "sec-fetch-site: same-origin", "sec-fetch-mode: cors", "sec-fetch-dest: empty", "referer: https://www.acfun.cn/member/", "accept-language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6,ja;q=0.5", "cookie: _did=web_32586178239268B; sign_remind=1; ac__avi=1010934062045114530882ab2cd25b90ef370ea22b151084981cf6c2c6febafe3a364146315ef65213; uuid=d7fdb48c886459236faa794ffafbfbb0; analytics=GA1.2.626694313.1592365512; lsv_js_player_v2_main=62b719; csrfToken=TnNz3lG1IfA-93kw4M-Px06m; session_id=63965769975BFD30; webp_supported=%7B%22lossy%22%3Atrue%2C%22lossless%22%3Atrue%2C%22alpha%22%3Atrue%2C%22animation%22%3Atrue%7D; Hm_lvt_2af69bc2b378fb58ae04ed2a04257ed1=1592481541,1592489023,1592797550,1592976124; lsv_js_player_v1_main=f2c6e6; stochastic=NWFlaDB1ZjlmNXE%3D; acPasstoken=ChVpbmZyYS5hY2Z1bi5wYXNzdG9rZW4ScJrFeEdlHcrvoHjYpzy_V7pAPxxMhNmo45RlMccpB84XwmIx9rJocLwXSPnJu4btgtqVGa04P9AIMBNdQknDd4QRTbjBp5aoQgis-Q88BjMvqVTGHAjG04W7zjswa0ZC5k5sdJCeTsLJKEiEsE8EY90aEhwsbiM70HUviQANoYC6Iptv6yIg0X6u8ikzzwuDe1VMKWNNYXWwFR81YKYQNq9P4gsk5oMoBTAB; auth_key=572984; ac_username=Nicksxs; acPostHint=1cc641584039a19bc0941d00e8eff73bd4b0; ac_userimg=https%3A%2F%2Fimgs.aixifan.com%2Fstyle%2Fimage%2F201907%2FuQ5Vc06d3HSVTjY3VZocT81X40FByVpw.jpg; clientlanguage=zh_CN; safety_id=AAG%2B9AbVZS6fTHVxwLtsI9Jl; notice_status=1; online_status=0; userGroupLevel=1; checkMobile=1; checkEmail=1; cur_req_id=1296724223CA632E_self_0fb782b0474cbe335574779cf53ed145; cur_group_id=1296724223CA632E_self_0fb782b0474cbe335574779cf53ed145_0; Hm_lpvt_2af69bc2b378fb58ae04ed2a04257ed1=1592976174", // "Content-Type: text/plain" ), )); $response = curl_exec($curl); curl_close($curl); echo $response; } public function downloadVideo() { $innerDir = "/Volumes/intel660p/video/mv/acfun"; $list = AcfunVideo::all(); $files = scandir($innerDir); // dump($files); foreach ($list as $item) { if ($item["is_downloaded"] == 1) { continue; } if (in_array($item['title'] . " (" . $item["from_up_name"] . ").mp4", $files)) { Log::info("file " . $item["title"] . ".mp4" . " exists continue"); continue; } Log::info($item['title'] . " (" . $item["from_up_name"] . ").mp4" . " does not exists to download"); // exit; $downloadResult = shell_exec('cd "' .$innerDir .'" && you-get https://www.acfun.cn/v/ac' . $item["content_id"]); Log::info($downloadResult); $item["is_downloaded"] = 1; $item->save(); } } }