diff --git a/app/Console/Commands/DailySignCommand.php b/app/Console/Commands/DailySignCommand.php new file mode 100644 index 0000000..8d13803 --- /dev/null +++ b/app/Console/Commands/DailySignCommand.php @@ -0,0 +1,45 @@ +signClubHmoe(); + // + } +} diff --git a/app/Console/Commands/FullSiteCommand.php b/app/Console/Commands/FullSiteCommand.php index c058784..c8ec757 100644 --- a/app/Console/Commands/FullSiteCommand.php +++ b/app/Console/Commands/FullSiteCommand.php @@ -39,6 +39,7 @@ class FullSiteCommand extends Command public function handle() { $service = new FullSiteService(); +// $service->replaceImagePath();exit; $service->fullSiteDownloadImage(); // } diff --git a/app/Console/Commands/RenameTest.php b/app/Console/Commands/RenameTest.php index d03ddfc..bcd1226 100644 --- a/app/Console/Commands/RenameTest.php +++ b/app/Console/Commands/RenameTest.php @@ -40,7 +40,7 @@ class RenameTest extends Command { // $rename = new RenameService(); - $rename->rename("/Users/shixuesen/Documents/tmp/秀人旗下《YouWu尤物馆》套图及视频写真-TLoB/套图/"); + $rename->rename("/Users/shixuesen/Documents/tmp/福利姬 软软趴在床单上-铃木美咲(Misaki Suzuki) 合集-TLoB/"); // $rename->rename(); // $rename->mvFiles("/Users/shixuesen/Documents/tmp/秀人旗下《MFStar模范学院》套图及视频写真-TLoB/视频/"); } diff --git a/app/Console/Commands/TujiguCommand.php b/app/Console/Commands/TujiguCommand.php index 3caf5e7..f5ef1c8 100644 --- a/app/Console/Commands/TujiguCommand.php +++ b/app/Console/Commands/TujiguCommand.php @@ -39,6 +39,13 @@ class TujiguCommand extends Command public function handle() { // +// $titleStr = "杨晨晨/玛鲁娜/许诺Sabrina/兜豆靓《海边众女神美臀福利》 [爱蜜社IMISS] Vol.150 写真集"; +// $titleStr = preg_replace("#/#", "-", $titleStr); +// echo $titleStr;exit; +// $albumUrl = "https://www.tujigu.com/a/8401/"; +// $albumCode = explode("/", $albumUrl)[4]; +// echo $albumCode;exit; + $service = new TujiguService(); $service->scrapeTujiguGirls(); } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 01a6506..d395061 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -4,6 +4,7 @@ namespace App\Console; use App\Services\BilibiliService; use App\Services\CompressImageService; +use App\Services\DailySignService; use App\Services\NewXiuGirlsService; use App\Services\XiuGirlsService; use App\Services\VitabioticsService; @@ -124,6 +125,10 @@ class Kernel extends ConsoleKernel $xiuService->scrapeXiuGirls(); // })->everyMinute(); })->dailyAt('05:00'); + $schedule->call(function () { + $dailySignService = new DailySignService(); + $dailySignService->signClubHmoe(); + })->dailyAt('04:00'); diff --git a/app/Services/DailySignService.php b/app/Services/DailySignService.php new file mode 100644 index 0000000..52de01e --- /dev/null +++ b/app/Services/DailySignService.php @@ -0,0 +1,46 @@ + "https://club.hmoe.club/wp-json/b2/v1/userMission", + 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_HTTPHEADER => array( + "authority: club.hmoe.club", + "content-length: 0", + "pragma: no-cache", + "cache-control: no-cache", + "accept: application/json, text/plain, */*", + "authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvY2x1Yi5obW9lLmNsdWIiLCJpYXQiOjE2MDAxNTUyNzcsIm5iZiI6MTYwMDE1NTI3NywiZXhwIjoxNjAwNzYwMDc3LCJkYXRhIjp7InVzZXIiOnsiaWQiOiIzODI5NyJ9fX0.eCpbJ-qqYQuS-n04Z-7nUz0C1G06TVdYaZwAHI4dMMo", + "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36", + "origin: https://club.hmoe.club", + "sec-fetch-site: same-origin", + "sec-fetch-mode: cors", + "sec-fetch-dest: empty", + "referer: https://club.hmoe.club/", + "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: PHPSESSID=s5j99cdcp99a2go41mq3c3f6hm; wordpress_logged_in_eb096bd0935f7dd6358a62cbe85a51c3=user38297_694%7C1601364877%7CJMM25vh5jDz4ZO21TWW0xm4vJhaNwR8Hhi06USiyEwz%7C9678dbb8017d50d1b20006500c21ee03bec9bc580756c2bc326bc645e14e4222" + ), + )); + + $response = curl_exec($curl); + + curl_close($curl); + echo $response; + + } +} diff --git a/app/Services/FullSiteService.php b/app/Services/FullSiteService.php index 28b93f8..8f4b0bd 100644 --- a/app/Services/FullSiteService.php +++ b/app/Services/FullSiteService.php @@ -7,8 +7,10 @@ class FullSiteService { public function fullSiteDownloadImage() { - $dir = "/Volumes/WD/tmp/site/mm24.cc/beautyleg/"; + $dir = "/Volumes/WD/tmp/site/mm24.cc/simu/"; $files = scandir($dir); + dump("total files count is " . count($files)); +// $files = array_slice($files, 38300); $ql = QueryList::getInstance(); $i = 0; foreach ($files as $file) { @@ -19,10 +21,10 @@ class FullSiteService { if ($file == "." || $file == ".." || $file == ".DS_Store") { continue; } - $htmlNum = substr($file, 0, 4); - if ((int)$htmlNum < 1072) { - continue; - } +// $htmlNum = substr($file, 0, 4); +// if ((int)$htmlNum < 3776) { +// continue; +// } if (str_contains($file, "html")) { dump($file); $ql = $ql->html(file_get_contents($dir. "/" . $file)); @@ -50,10 +52,33 @@ class FullSiteService { continue; } file_put_contents($dir . "../" . $path . "/" .$filePathInfo["basename"], $content); - usleep(1000 * random_int(1000, 10000)); + usleep(100 * random_int(1000, 10000)); } // dump($rt);exit; } } } + + public function replaceImagePath() + { + $dir = "/Volumes/WD/tmp/site/mm24.cc/beautyleg/"; +// $files = scandir($dir); +// dump("total files count is " . count($files)); +// foreach ($files as $file) { +// if ($file == "." || $file == ".." || $file == ".DS_Store") { +// continue; +// } +// dump($file); +// file_put_contents($dir . $file, str_replace("http://img.huangguogan.net", "..", file_get_contents($dir . $file))); +// exit; +// } + for ($i = 1; $i <= 46; $i++) { + if ($i == 1) { + $file = "4063.html"; + } else { + $file = "4063_" . $i . ".html"; + } + file_put_contents($dir . $file, str_replace("http://img.huangguogan.net", "..", file_get_contents($dir . $file))); + } + } } diff --git a/app/Services/HandBrakeService.php b/app/Services/HandBrakeService.php index 8573273..f9fe04e 100644 --- a/app/Services/HandBrakeService.php +++ b/app/Services/HandBrakeService.php @@ -6,7 +6,7 @@ namespace App\Services; class HandBrakeService { - public function handleVideos($dir = "/Users/shixuesen/Documents/tmp/秀人旗下《YouWu尤物馆》套图及视频写真-TLoB/") + public function handleVideos($dir = "/Users/shixuesen/Documents/tmp/福利姬 软软趴在床单上-铃木美咲(Misaki Suzuki) 合集-TLoB/") { $files = scandir($dir); foreach ($files as $file) { @@ -22,21 +22,26 @@ class HandBrakeService if (is_dir($subPathFile) || $subFile == ".DS_Store") { continue; } - if (is_file($subPathFile)) { - $fileInfo = pathinfo($subPathFile); - dump("fileInfo", $fileInfo); - if (ends_with($fileInfo["filename"], "-1")) { - continue; - } - if (is_file($fileInfo["dirname"] . '/' .$fileInfo["filename"] . '-1'. '.' . $fileInfo["extension"])) { - continue; - } - $targetFile = $fileInfo["dirname"] . '/' .$fileInfo["filename"] . '-1'. '.' . $fileInfo["extension"]; - dump("targetFile", [$targetFile]); + $mime = mime_content_type($subPathFile); +// dump("file type", [$mime, $subPathFile]); +// continue; + if (strstr($mime, "video/")) { + if (is_file($subPathFile)) { + $fileInfo = pathinfo($subPathFile); + dump("fileInfo", $fileInfo); + if (ends_with($fileInfo["filename"], "-1")) { + continue; + } + if (is_file($fileInfo["dirname"] . '/' .$fileInfo["filename"] . '-1'. '.' . $fileInfo["extension"])) { + continue; + } + $targetFile = $fileInfo["dirname"] . '/' .$fileInfo["filename"] . '-1'. '.' . $fileInfo["extension"]; + dump("targetFile", [$targetFile]); // $result = shell_exec("handBrakeCli -Z 'Very Fast 720p30' -i '". $subPathFile ."' -o '". $targetFile . " && echo 'success'"); - $result = shell_exec("handBrakeCli -Z 'Very Fast 720p30' -i '". $subPathFile ."' -o '". $targetFile . "'"); - dump($result); + $result = shell_exec("handBrakeCli -Z 'Very Fast 720p30' -i '". $subPathFile ."' -o '". $targetFile . "'"); + dump($result); + } } } } diff --git a/app/Services/NewNvshenService.php b/app/Services/NewNvshenService.php index f422d2a..7ac97e5 100644 --- a/app/Services/NewNvshenService.php +++ b/app/Services/NewNvshenService.php @@ -144,6 +144,7 @@ class NewNvshenService $baseAlbumUrl = "https://www.nvshens.net/girl/{$name['code']}/album/"; for ($i = 1; $i <= $totalAlbumPage; $i++) { + dump("current album page no: " . $i); if ($onlyOnePage) { $albumQl = $mainQl->get($peopleUrl); } else { @@ -161,8 +162,20 @@ class NewNvshenService usleep(10000 * random_int(1000, 10000)); dump("相册:", [$album]); // $pageQL = $qL0->get($baseUrl . $album); - $page = $mainQl->get($baseUrl . $album, [], ['maxTry' => 5])->find(".albumInfo > span")->htmls(); - $title = $mainQl->get($baseUrl . $album, [], ['maxTry' => 5])->find(".albumTitle > #htilte")->htmls(); + for ($m = 0; $m < 100; $m++) { + try { + $page = $mainQl->get($baseUrl . $album, [], ['maxTry' => 5])->find(".albumInfo > span")->htmls(); + $title = $mainQl->get($baseUrl . $album, [], ['maxTry' => 5])->find(".albumTitle > #htilte")->htmls(); + break; + } catch (ConnectException $e) { + echo 'connection error: ' . $e->getMessage() . "\n"; + echo "retry times: " . $m . " times \n"; + sleep(1); + $sleepTime = 1000 * random_int(1000, 10000); + echo "retry sleep {$sleepTime} nano second \n"; + usleep($sleepTime); + } + } dump($title->all()); $titleStr = $title->all()[0]; preg_match("#\d+#", $page->all()[0], $result); diff --git a/app/Services/TujiguService.php b/app/Services/TujiguService.php index df1d5d1..a4fc59f 100644 --- a/app/Services/TujiguService.php +++ b/app/Services/TujiguService.php @@ -12,70 +12,77 @@ class TujiguService private static $name_dir = [ // "周韦彤" => [ // "dir" => "周韦彤", -// "code" => 16274, +// "code" => 1456, // "name" => "周韦彤" // ], // "ycc" => [ // "dir" => "ycc", -// "code" => 22162, +// "code" => 459, // "name" => "杨晨晨" // ], // "ry" => [ // "dir" => "忍野さら", -// "code" => "21250", +// "code" => "1875", // "name" => "忍野さら" // ], // "azu" => [ // "dir" => "azu", -// "code" => 26002, +// "code" => 437, // "name" => "阿朱" // ], // "xq" => [ // "dir" => "xq", -// "code" => 22204, +// "code" => 2438, // "name" => "小琪" // ], // "ygh" => [ // "dir" => "ygh", -// "code" => 15902, +// "code" => 550, // "name" => "原干惠" // ], // "wyc" => [ // "dir" => "wyc", -// "code" => 19702, +// "code" => 293, // "name" => "王语纯" // ], -// "zz" => [ -// "dir" => "zz", -// "code" => 22899, -// "name" => "芝芝 booty" -// ], -// "hlr" => [ -// "dir" => "hlr", -// "code" => 20015, -// "name" => "黄乐然" -// ], + "zz" => [ + "dir" => "zz", + "code" => 954, + "name" => "芝芝 booty" + ], + "hlr" => [ + "dir" => "hlr", + "code" => 1289, + "name" => "黄乐然" + ], "jrq" => [ "dir" => "jrq", "code" => 5034, "name" => "姜仁卿" ], -// "ny" => [ -// "dir" => "ny", -// "code" => 26298, -// "name" => "奈月" -// ], -// "杉本有美" => [ -// "dir" => "杉本有美", -// "code" => 15939, -// "name" => "杉本有美" -// ] + "ny" => [ + "dir" => "ny", + "code" => 5301, + "name" => "奈月" + ], + "杉本有美" => [ + "dir" => "杉本有美", + "code" => 632, + "name" => "杉本有美" + ], + "糯美子" => [ + "dir" => "糯美子", + "code" => 161, + "name" => "糯美子" + ] ]; public function scrapeTujiguGirls() { foreach (self::$name_dir as $username => $name) { + // 重置下这个 map,不同网站,不同人可能会有相册 id 重复的情况 + $albumCodeMap = []; // $baseDir = "/Users/shixuesen/Documents/tmp/image/xg/" . $name['dir'] . "/"; $baseDir = "/Volumes/intel660p/image/xg/" . $name["dir"] . "/"; // 处理两个网站对应图册名不一致,直接取图册 id 作为唯一性判断的 map @@ -115,28 +122,36 @@ class TujiguService $totalAlbumPage = ceil($totalAlbumNum / 40); } $baseAlbumUrl = "https://www.tujigu.com/t/{$name['code']}/"; - for ($i = 1; $i <= $totalAlbumPage; $i++) { - if ($onlyOnePage || $totalAlbumPage == 1) { + for ($i = 1; $i < $totalAlbumPage; $i++) { + if ($onlyOnePage || $totalAlbumPage == 1 || $i == 0) { $albumQl = QueryList::get($peopleUrl); } else { - $albumQl = QueryList::get($baseAlbumUrl . $i . ".html"); + $albumQl = QueryList::get($baseAlbumUrl . "index_".$i . ".html"); } // dump($albumQl->getHtml()); $albumList = $albumQl->find("body > div.hezi > ul > li > a")->attrs("href"); $pageAlbum = $albumList->all(); dump($pageAlbum); foreach ($pageAlbum as $album) { - usleep(1000 * random_int(1000, 10000)); + dump("current album page no: " . $i); + usleep(10000 * random_int(1000, 10000)); dump("相册:", [$album]); $pageQL = QueryList::get( $album); - $page = $pageQL->find("body > div.tuji > p:nth-child(6)")->htmls(); + $page = $pageQL->find("body > div.tuji > p:nth-child(5)")->htmls(); + $pageAlternative = $pageQL->find("body > div.tuji > p:nth-child(6)")->htmls(); $title = $pageQL->find("body > div.tuji > div.weizhi > h1")->htmls(); dump($title->all()); $titleStr = $title->all()[0]; - preg_match("#\d+#", $page->all()[0], $result); - $totalImageNum = $result[0]; + $titleStr = preg_replace("#/#", "-", $titleStr); + preg_match("#图片数量: (\d+)P#", $page->all()[0], $result); + if (count($result) < 2) { + preg_match("#图片数量: (\d+)P#", $pageAlternative->all()[0], $result); + } + $totalImageNum = $result[1]; for ($j = 1; $j <= $totalImageNum; $j++) { - $albumCode = substr($album, 25, 5); +// $albumCode = substr($album, 25, 5); + $albumCode = explode("/", $album)[4]; + $baseImageUrl = "https://lns.hywly.com/a/1/{$albumCode}/"; // if ($j == 0) { // $imageName = $j . ".jpg";