| @ -0,0 +1,49 @@ | |||||
| APP_NAME=Laravel | |||||
| APP_ENV=local | |||||
| APP_KEY=base64:BNE3RoAp39H4EB1jWx0c1xJI3arhkasdMAz52FsCc1U= | |||||
| APP_DEBUG=true | |||||
| APP_URL=http://localhost | |||||
| LOG_CHANNEL=stack | |||||
| DB_CONNECTION=mysql | |||||
| DB_HOST=127.0.0.1 | |||||
| DB_PORT=3306 | |||||
| DB_DATABASE=ins | |||||
| DB_USERNAME=root | |||||
| DB_PASSWORD= | |||||
| BROADCAST_DRIVER=log | |||||
| CACHE_DRIVER=file | |||||
| QUEUE_CONNECTION=sync | |||||
| SESSION_DRIVER=file | |||||
| SESSION_LIFETIME=120 | |||||
| REDIS_HOST=127.0.0.1 | |||||
| REDIS_PASSWORD=null | |||||
| REDIS_PORT=6379 | |||||
| MAIL_DRIVER=smtp | |||||
| MAIL_HOST=smtp.mailtrap.io | |||||
| MAIL_PORT=2525 | |||||
| MAIL_USERNAME=null | |||||
| MAIL_PASSWORD=null | |||||
| MAIL_ENCRYPTION=null | |||||
| PUSHER_APP_ID= | |||||
| PUSHER_APP_KEY= | |||||
| PUSHER_APP_SECRET= | |||||
| PUSHER_APP_CLUSTER=mt1 | |||||
| MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | |||||
| MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" | |||||
| OAUTH_APP_ID=89b50ce9-fcd4-4d6b-a830-bbfe0fa5703b | |||||
| OAUTH_APP_PASSWORD=gmwsDOF38_+ycvIDAH885[) | |||||
| OAUTH_REDIRECT_URI=http://localhost:8000/callback | |||||
| #OAUTH_SCOPES='openid profile offline_access user.read calendars.read Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All' | |||||
| OAUTH_SCOPES='openid profile offline_access user.read calendars.read' | |||||
| OAUTH_AUTHORITY=https://login.microsoftonline.com/common | |||||
| OAUTH_AUTHORIZE_ENDPOINT=/oauth2/v2.0/authorize | |||||
| OAUTH_TOKEN_ENDPOINT=/oauth2/v2.0/token | |||||
| @ -0,0 +1,28 @@ | |||||
| <?php | |||||
| namespace App; | |||||
| use Illuminate\Database\Eloquent\Model; | |||||
| /** | |||||
| * App\BiCookies | |||||
| * | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BiCookies newModelQuery() | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BiCookies newQuery() | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BiCookies query() | |||||
| * @mixin \Eloquent | |||||
| * @property int $id | |||||
| * @property string $cookie | |||||
| * @property \Illuminate\Support\Carbon|null $created_at | |||||
| * @property \Illuminate\Support\Carbon|null $updated_at | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BiCookies whereCookie($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BiCookies whereCreatedAt($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BiCookies whereId($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BiCookies whereUpdatedAt($value) | |||||
| */ | |||||
| class BiCookies extends Model | |||||
| { | |||||
| // | |||||
| protected $fillable = ["id", "cookie"]; | |||||
| } | |||||
| @ -0,0 +1,34 @@ | |||||
| <?php | |||||
| namespace App; | |||||
| use Illuminate\Database\Eloquent\Model; | |||||
| /** | |||||
| * App\BilibiliCollections | |||||
| * | |||||
| * @property int $id | |||||
| * @property int $media_id 收藏夹识别 id | |||||
| * @property string $title 收藏夹名称 | |||||
| * @property int $video_id 视频 id | |||||
| * @property int $is_available 是否有效,0:有效,1:失效 | |||||
| * @property int $is_downloaded 是否已下载, 0: 未下载, 1:已下载 | |||||
| * @property \Illuminate\Support\Carbon|null $created_at | |||||
| * @property \Illuminate\Support\Carbon|null $updated_at | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections newModelQuery() | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections newQuery() | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections query() | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections whereCreatedAt($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections whereId($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections whereIsAvailable($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections whereIsDownloaded($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections whereMediaId($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections whereTitle($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections whereUpdatedAt($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliCollections whereVideoId($value) | |||||
| * @mixin \Eloquent | |||||
| */ | |||||
| class BilibiliCollections extends Model | |||||
| { | |||||
| // | |||||
| } | |||||
| @ -0,0 +1,34 @@ | |||||
| <?php | |||||
| namespace App; | |||||
| use Illuminate\Database\Eloquent\Model; | |||||
| /** | |||||
| * App\BilibiliUpVideos | |||||
| * | |||||
| * @property int $id | |||||
| * @property int $mid up的唯一识别 id | |||||
| * @property string $up_name up 名 | |||||
| * @property int $video_id 视频 id | |||||
| * @property int $is_available 是否有效,0:有效,1:失效 | |||||
| * @property int $is_downloaded 是否已下载, 0: 未下载, 1:已下载 | |||||
| * @property \Illuminate\Support\Carbon|null $created_at | |||||
| * @property \Illuminate\Support\Carbon|null $updated_at | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos newModelQuery() | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos newQuery() | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos query() | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos whereCreatedAt($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos whereId($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos whereIsAvailable($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos whereIsDownloaded($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos whereMid($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos whereUpName($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos whereUpdatedAt($value) | |||||
| * @method static \Illuminate\Database\Eloquent\Builder|\App\BilibiliUpVideos whereVideoId($value) | |||||
| * @mixin \Eloquent | |||||
| */ | |||||
| class BilibiliUpVideos extends Model | |||||
| { | |||||
| // | |||||
| } | |||||
| @ -0,0 +1,93 @@ | |||||
| <?php | |||||
| namespace App\Http\Controllers; | |||||
| use App\BiCookies; | |||||
| use Illuminate\Http\Request; | |||||
| class BiCookiesController extends Controller | |||||
| { | |||||
| public function receiveCookie(Request $request) { | |||||
| // \Log::info("here"); | |||||
| // \Log::info(json_encode($request->input())); | |||||
| \Log::info($request->input("cookies")); | |||||
| BiCookies::updateOrCreate(['id' => 1], ["cookie" => base64_encode($request->input("cookies"))]); | |||||
| // echo json_encode($request); | |||||
| } | |||||
| /** | |||||
| * Display a listing of the resource. | |||||
| * | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function index() | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Show the form for creating a new resource. | |||||
| * | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function create() | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Store a newly created resource in storage. | |||||
| * | |||||
| * @param \Illuminate\Http\Request $request | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function store(Request $request) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Display the specified resource. | |||||
| * | |||||
| * @param \App\BiCookies $biCookies | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function show(BiCookies $biCookies) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Show the form for editing the specified resource. | |||||
| * | |||||
| * @param \App\BiCookies $biCookies | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function edit(BiCookies $biCookies) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Update the specified resource in storage. | |||||
| * | |||||
| * @param \Illuminate\Http\Request $request | |||||
| * @param \App\BiCookies $biCookies | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function update(Request $request, BiCookies $biCookies) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Remove the specified resource from storage. | |||||
| * | |||||
| * @param \App\BiCookies $biCookies | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function destroy(BiCookies $biCookies) | |||||
| { | |||||
| // | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,90 @@ | |||||
| <?php | |||||
| namespace App\Http\Controllers; | |||||
| use App\BilibiliCollections; | |||||
| use Illuminate\Http\Request; | |||||
| class BilibiliCollectionsController extends Controller | |||||
| { | |||||
| public function getCookie(Request $request) { | |||||
| \Log::info("here"); | |||||
| \Log::info(json_encode($request->input())); | |||||
| echo json_encode($request); | |||||
| } | |||||
| /** | |||||
| * Display a listing of the resource. | |||||
| * | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function index() | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Show the form for creating a new resource. | |||||
| * | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function create() | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Store a newly created resource in storage. | |||||
| * | |||||
| * @param \Illuminate\Http\Request $request | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function store(Request $request) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Display the specified resource. | |||||
| * | |||||
| * @param \App\BilibiliCollections $bilibiliCollections | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function show(BilibiliCollections $bilibiliCollections) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Show the form for editing the specified resource. | |||||
| * | |||||
| * @param \App\BilibiliCollections $bilibiliCollections | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function edit(BilibiliCollections $bilibiliCollections) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Update the specified resource in storage. | |||||
| * | |||||
| * @param \Illuminate\Http\Request $request | |||||
| * @param \App\BilibiliCollections $bilibiliCollections | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function update(Request $request, BilibiliCollections $bilibiliCollections) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Remove the specified resource from storage. | |||||
| * | |||||
| * @param \App\BilibiliCollections $bilibiliCollections | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function destroy(BilibiliCollections $bilibiliCollections) | |||||
| { | |||||
| // | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,85 @@ | |||||
| <?php | |||||
| namespace App\Http\Controllers; | |||||
| use App\BilibiliUpVideos; | |||||
| use Illuminate\Http\Request; | |||||
| class BilibiliUpVideosController extends Controller | |||||
| { | |||||
| /** | |||||
| * Display a listing of the resource. | |||||
| * | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function index() | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Show the form for creating a new resource. | |||||
| * | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function create() | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Store a newly created resource in storage. | |||||
| * | |||||
| * @param \Illuminate\Http\Request $request | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function store(Request $request) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Display the specified resource. | |||||
| * | |||||
| * @param \App\BilibiliUpVideos $bilibiliUpVideos | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function show(BilibiliUpVideos $bilibiliUpVideos) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Show the form for editing the specified resource. | |||||
| * | |||||
| * @param \App\BilibiliUpVideos $bilibiliUpVideos | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function edit(BilibiliUpVideos $bilibiliUpVideos) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Update the specified resource in storage. | |||||
| * | |||||
| * @param \Illuminate\Http\Request $request | |||||
| * @param \App\BilibiliUpVideos $bilibiliUpVideos | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function update(Request $request, BilibiliUpVideos $bilibiliUpVideos) | |||||
| { | |||||
| // | |||||
| } | |||||
| /** | |||||
| * Remove the specified resource from storage. | |||||
| * | |||||
| * @param \App\BilibiliUpVideos $bilibiliUpVideos | |||||
| * @return \Illuminate\Http\Response | |||||
| */ | |||||
| public function destroy(BilibiliUpVideos $bilibiliUpVideos) | |||||
| { | |||||
| // | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,229 @@ | |||||
| <?php | |||||
| namespace App\Services; | |||||
| class BilibiliService { | |||||
| public function queryPlayList() | |||||
| { | |||||
| $pageNo = 1; | |||||
| $url = "https://space.bilibili.com/ajax/member/getSubmitVideos?mid=391073761&pagesize=30&tid=0&keyword=&order=pubdate&page="; | |||||
| for ($i= 1; $i < 22; $i++) { | |||||
| # code... | |||||
| $result = json_decode(file_get_contents($url . $i), true); | |||||
| foreach ($result['data']['vlist'] as $item) { | |||||
| echo "av" . $item['aid'] . " "; | |||||
| } | |||||
| // echo $result['data']['vlist'][0]['aid'] . "\t"; | |||||
| // $pageNo++; | |||||
| } | |||||
| } | |||||
| public function queryUpVideoList($mediaId = 475250) | |||||
| { | |||||
| $pageNo = 1; | |||||
| $url = "https://api.bilibili.com/x/space/arc/search?mid=475250&ps=30&tid=0&keyword=&order=pubdate&jsonp=jsonp&pn="; | |||||
| // https://space.bilibili.com/475250/video | |||||
| for ($i= 1; $i < 22; $i++) { | |||||
| # code... | |||||
| $curl = curl_init(); | |||||
| curl_setopt_array($curl, array( | |||||
| CURLOPT_URL => "https://api.bilibili.com/x/space/arc/search?mid=475250&ps=30&tid=0&keyword=&order=pubdate&jsonp=jsonp&pn={$i}", | |||||
| CURLOPT_RETURNTRANSFER => true, | |||||
| CURLOPT_ENCODING => "", | |||||
| CURLOPT_MAXREDIRS => 10, | |||||
| CURLOPT_TIMEOUT => 30, | |||||
| CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |||||
| CURLOPT_CUSTOMREQUEST => "GET", | |||||
| CURLOPT_HTTPHEADER => array( | |||||
| "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3", | |||||
| "Accept-Encoding: gzip, deflate, br", | |||||
| "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", | |||||
| "Cache-Control: no-cache", | |||||
| "Connection: keep-alive", | |||||
| "Referer: https://www.bilibili.com", | |||||
| "Pragma: no-cache", | |||||
| "Sec-Fetch-Mode: navigate", | |||||
| "Sec-Fetch-Site: none", | |||||
| "Sec-Fetch-User: ?1", | |||||
| "Upgrade-Insecure-Requests: 1", | |||||
| "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36", | |||||
| "cache-control: no-cache" | |||||
| ), | |||||
| )); | |||||
| $response = curl_exec($curl); | |||||
| $err = curl_error($curl); | |||||
| curl_close($curl); | |||||
| if ($err) { | |||||
| echo "cURL Error #:" . $err; | |||||
| } else { | |||||
| echo $response; | |||||
| $result = json_decode($response, true); | |||||
| foreach ($result['data']['list']['vlist'] as $item) { | |||||
| echo "av" . $item['aid'] . " "; | |||||
| } | |||||
| } | |||||
| exit; | |||||
| // echo $result['data']['vlist'][0]['aid'] . "\t"; | |||||
| // $pageNo++; | |||||
| } | |||||
| } | |||||
| public function queryFavList() | |||||
| { | |||||
| $invalidTitle = "已失效视频"; | |||||
| $pageNo = 1; | |||||
| for ($i = 1; $i < 65; $i++) { | |||||
| $curl = curl_init(); | |||||
| $url = "https://api.bilibili.com/medialist/gateway/base/spaceDetail?media_id=50069625&pn={$i}&ps=20&keyword=&order=mtime&type=0&tid=0&jsonp=jsonp"; | |||||
| curl_setopt_array($curl, array( | |||||
| CURLOPT_URL => $url, | |||||
| CURLOPT_RETURNTRANSFER => true, | |||||
| CURLOPT_ENCODING => "", | |||||
| CURLOPT_MAXREDIRS => 10, | |||||
| CURLOPT_TIMEOUT => 30, | |||||
| CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |||||
| CURLOPT_CUSTOMREQUEST => "GET", | |||||
| CURLOPT_HTTPHEADER => array( | |||||
| "Accept: application/json, text/plain, */*", | |||||
| "Accept-Encoding: gzip, deflate, br", | |||||
| "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6,ja;q=0.5", | |||||
| "Cache-Control: no-cache", | |||||
| "Connection: keep-alive", | |||||
| // "Cookie: buvid3=5566647C-DDE5-4AFF-8711-89C9DB2B7061110244infoc; LIVE_BUVID=AUTO2315591376644842; sid=kbyrjw72; stardustvideo=1; CURRENT_FNVAL=16; rpdid=|(J~|JluJmmk0J\'ullmuJ~~kJ; CURRENT_QUALITY=80; UM_distinctid=16b11bb4099eb-033fd8b69a435d-37647e03-13c680-16b11bb40bf97; fts=1562149769; im_notify_type_279025=0; _uuid=69A60E94-E8FE-54B8-DCCD-0F519F0DEF7480343infoc; DedeUserID=279025; DedeUserID__ckMd5=9a79e15294e6b8bb; SESSDATA=b114a39d%2C1573361994%2C2ed0a2a1; bili_jct=b35f8e9780e4a80dd07f316f781f179b; bp_t_offset_279025=315386152995357818", | |||||
| "Cookie: SESSDATA=6cf335a1%2C1576033995%2C69d8d2b1", | |||||
| "Host: api.bilibili.com", | |||||
| "Origin: https://space.bilibili.com", | |||||
| "Postman-Token: c7f849ec-aaf9-4c71-851d-4ca061e725d0,f8f582bc-4872-4aa7-b209-b926364d4d1a", | |||||
| "Referer: https://space.bilibili.com/279025/favlist", | |||||
| "Sec-Fetch-Mode: cors", | |||||
| "Sec-Fetch-Site: same-site", | |||||
| "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36", | |||||
| "cache-control: no-cache" | |||||
| ), | |||||
| )); | |||||
| $response = curl_exec($curl); | |||||
| $err = curl_error($curl); | |||||
| curl_close($curl); | |||||
| if ($err) { | |||||
| echo "cURL Error #:" . $err; | |||||
| } else { | |||||
| $responseArr = json_decode($response, true); | |||||
| if ($responseArr['code'] == 0) { | |||||
| $data = $responseArr['data']; | |||||
| $medias = $data['medias']; | |||||
| if (count($medias) > 0) { | |||||
| foreach ($medias as $item) { | |||||
| if ($item['title'] != $invalidTitle) { | |||||
| echo "av" . $item['id'] . "\t"; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| usleep(random_int(1000, 10000) * 1000); | |||||
| } | |||||
| } | |||||
| public function getAoaFavList($id = 50076725) | |||||
| { | |||||
| $invalidTitle = "已失效视频"; | |||||
| $pageNo = 1; | |||||
| for ($i = 1; $i < 65; $i++) { | |||||
| $curl = curl_init(); | |||||
| $url = "https://api.bilibili.com/medialist/gateway/base/spaceDetail?media_id=50076725&pn={$i}&ps=20&keyword=&order=mtime&type=0&tid=0&jsonp=jsonp"; | |||||
| curl_setopt_array($curl, array( | |||||
| CURLOPT_URL => $url, | |||||
| CURLOPT_RETURNTRANSFER => true, | |||||
| CURLOPT_ENCODING => "", | |||||
| CURLOPT_MAXREDIRS => 10, | |||||
| CURLOPT_TIMEOUT => 30, | |||||
| CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |||||
| CURLOPT_CUSTOMREQUEST => "GET", | |||||
| CURLOPT_HTTPHEADER => array( | |||||
| "Accept: application/json, text/plain, */*", | |||||
| "Accept-Encoding: gzip, deflate, br", | |||||
| "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6,ja;q=0.5", | |||||
| "Cache-Control: no-cache", | |||||
| "Connection: keep-alive", | |||||
| "Cookie: buvid3=5566647C-DDE5-4AFF-8711-89C9DB2B7061110244infoc; LIVE_BUVID=AUTO2315591376644842; sid=kbyrjw72; stardustvideo=1; CURRENT_FNVAL=16; rpdid=|(J~|JluJmmk0J'ullmuJ~~kJ; CURRENT_QUALITY=80; UM_distinctid=16b11bb4099eb-033fd8b69a435d-37647e03-13c680-16b11bb40bf97; fts=1562149769; im_notify_type_279025=0; _uuid=69A60E94-E8FE-54B8-DCCD-0F519F0DEF7480343infoc; DedeUserID=279025; DedeUserID__ckMd5=9a79e15294e6b8bb; SESSDATA=b114a39d%2C1573361994%2C2ed0a2a1; bili_jct=b35f8e9780e4a80dd07f316f781f179b; bp_t_offset_279025=317592473398470273", | |||||
| "Host: api.bilibili.com", | |||||
| "Origin: https://space.bilibili.com", | |||||
| "Postman-Token: c7f849ec-aaf9-4c71-851d-4ca061e725d0,f8f582bc-4872-4aa7-b209-b926364d4d1a", | |||||
| "Referer: https://space.bilibili.com/279025/favlist", | |||||
| "Sec-Fetch-Mode: cors", | |||||
| "Sec-Fetch-Site: same-site", | |||||
| "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36", | |||||
| "cache-control: no-cache" | |||||
| ), | |||||
| )); | |||||
| $response = curl_exec($curl); | |||||
| $err = curl_error($curl); | |||||
| curl_close($curl); | |||||
| if ($err) { | |||||
| echo "cURL Error #:" . $err; | |||||
| } else { | |||||
| $responseArr = json_decode($response, true); | |||||
| if ($responseArr['code'] == 0) { | |||||
| $data = $responseArr['data']; | |||||
| $medias = $data['medias']; | |||||
| if (count($medias) > 0) { | |||||
| foreach ($medias as $item) { | |||||
| if ($item['title'] != $invalidTitle) { | |||||
| echo "av" . $item['id'] . " "; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| usleep(random_int(1000, 10000) * 1000); | |||||
| } | |||||
| } | |||||
| public function downloadBSitePlaylist($aid, $dir = "/Volumes/intel660p/video/mv/mp4") | |||||
| { | |||||
| $dirExists = is_dir($dir); | |||||
| if ($dirExists) { | |||||
| echo shell_exec("cd {$dir} && annie -n 100 -p " .$aid); | |||||
| } | |||||
| } | |||||
| public function deleteFileNotContainP() | |||||
| { | |||||
| $dir = "/Volumes/intel660p/video/mv/mp4"; | |||||
| $files = scandir($dir); | |||||
| foreach ($files as $file) { | |||||
| if ($file == "." || $file == "..") { | |||||
| continue; | |||||
| } | |||||
| if (preg_match("#P\d{1,2}#", $file)) { | |||||
| echo $file. "\n"; | |||||
| } else { | |||||
| echo "to delete file " . $file ."\n"; | |||||
| unlink($dir ."/" . $file); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,9 @@ | |||||
| <?php | |||||
| use Faker\Generator as Faker; | |||||
| $factory->define(App\BiCookies::class, function (Faker $faker) { | |||||
| return [ | |||||
| // | |||||
| ]; | |||||
| }); | |||||
| @ -0,0 +1,9 @@ | |||||
| <?php | |||||
| use Faker\Generator as Faker; | |||||
| $factory->define(App\BilibiliCollections::class, function (Faker $faker) { | |||||
| return [ | |||||
| // | |||||
| ]; | |||||
| }); | |||||
| @ -0,0 +1,9 @@ | |||||
| <?php | |||||
| use Faker\Generator as Faker; | |||||
| $factory->define(App\BilibiliUpVideos::class, function (Faker $faker) { | |||||
| return [ | |||||
| // | |||||
| ]; | |||||
| }); | |||||
| @ -0,0 +1,37 @@ | |||||
| <?php | |||||
| use Illuminate\Support\Facades\Schema; | |||||
| use Illuminate\Database\Schema\Blueprint; | |||||
| use Illuminate\Database\Migrations\Migration; | |||||
| class CreateBilibiliCollectionsTable extends Migration | |||||
| { | |||||
| /** | |||||
| * Run the migrations. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function up() | |||||
| { | |||||
| Schema::create('bilibili_collections', function (Blueprint $table) { | |||||
| $table->increments('id'); | |||||
| $table->bigInteger("media_id")->comment("收藏夹识别 id"); | |||||
| $table->string("title")->comment("收藏夹名称"); | |||||
| $table->bigInteger("video_id")->comment("视频 id"); | |||||
| $table->unsignedTinyInteger("is_available")->comment("是否有效,0:有效,1:失效"); | |||||
| $table->unsignedTinyInteger("is_downloaded")->comment("是否已下载, 0: 未下载, 1:已下载"); | |||||
| $table->timestamps(); | |||||
| $table->index(["media_id", "video_id"], "idx_mid_aid"); | |||||
| }); | |||||
| } | |||||
| /** | |||||
| * Reverse the migrations. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function down() | |||||
| { | |||||
| Schema::dropIfExists('bilibili_collections'); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,37 @@ | |||||
| <?php | |||||
| use Illuminate\Support\Facades\Schema; | |||||
| use Illuminate\Database\Schema\Blueprint; | |||||
| use Illuminate\Database\Migrations\Migration; | |||||
| class CreateBilibiliUpVideosTable extends Migration | |||||
| { | |||||
| /** | |||||
| * Run the migrations. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function up() | |||||
| { | |||||
| Schema::create('bilibili_up_videos', function (Blueprint $table) { | |||||
| $table->increments('id'); | |||||
| $table->bigInteger("mid")->comment("up的唯一识别 id"); | |||||
| $table->string("up_name")->comment("up 名"); | |||||
| $table->bigInteger("video_id")->comment("视频 id"); | |||||
| $table->unsignedTinyInteger("is_available")->comment("是否有效,0:有效,1:失效"); | |||||
| $table->unsignedTinyInteger("is_downloaded")->comment("是否已下载, 0: 未下载, 1:已下载"); | |||||
| $table->timestamps(); | |||||
| $table->index(["mid", "video_id"], "idx_mid_aid"); | |||||
| }); | |||||
| } | |||||
| /** | |||||
| * Reverse the migrations. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function down() | |||||
| { | |||||
| Schema::dropIfExists('bilibili_up_videos'); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,32 @@ | |||||
| <?php | |||||
| use Illuminate\Support\Facades\Schema; | |||||
| use Illuminate\Database\Schema\Blueprint; | |||||
| use Illuminate\Database\Migrations\Migration; | |||||
| class CreateBiCookiesTable extends Migration | |||||
| { | |||||
| /** | |||||
| * Run the migrations. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function up() | |||||
| { | |||||
| Schema::create('bi_cookies', function (Blueprint $table) { | |||||
| $table->increments('id'); | |||||
| $table->string("cookie"); | |||||
| $table->timestamps(); | |||||
| }); | |||||
| } | |||||
| /** | |||||
| * Reverse the migrations. | |||||
| * | |||||
| * @return void | |||||
| */ | |||||
| public function down() | |||||
| { | |||||
| Schema::dropIfExists('bi_cookies'); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,2 @@ | |||||
| #!/bin/sh | |||||
| php /Users/shixuesen/workspace/dev/src/graph-tutorial/artisan serve --env=local | |||||