update
parent
9a630f6b66
commit
3e8552d47b
|
@ -285,34 +285,4 @@ class ApiController extends Controller
|
|||
'data' => $dataScrapping,
|
||||
]);
|
||||
}
|
||||
|
||||
public function testScrapping()
|
||||
{
|
||||
$client = new Client();
|
||||
|
||||
|
||||
$url = "https://ww1.anoboy.app/2016/10/one-piece-indonesia";
|
||||
|
||||
$response = Http::timeout(300)->withoutVerifying()->get($url);
|
||||
$html = $response->body();
|
||||
|
||||
$crawler = new Crawler($html);
|
||||
$table = $crawler->filter('table')->first();
|
||||
|
||||
$episodes = [];
|
||||
$crawler->filter('ul#lcp_instance_0 li a')->each(function ($node) use (&$episodes) {
|
||||
$title = $node->text();
|
||||
$url = $node->attr('href');
|
||||
|
||||
// Hanya ambil link yang berkaitan dengan One Piece
|
||||
// if (stripos($title, 'One Piece') !== false) {
|
||||
$episodes[] = [
|
||||
'title' => $title,
|
||||
'url' => $url,
|
||||
];
|
||||
// }
|
||||
});
|
||||
|
||||
return response()->json($episodes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,4 @@ Route::get('getKecamatan',[ApiController::class,'getKecamatan']);
|
|||
Route::get('getSekolah',[ApiController::class,'getSekolah']);
|
||||
Route::get('/scrappingMI', [ApiController::class, 'scrappingMI']);
|
||||
Route::get('/scrappingMA', [ApiController::class, 'scrappingMA']);
|
||||
|
||||
Route::get('/testScrapping', [ApiController::class, 'testScrapping']);
|
||||
|
||||
// Route::get('getKabupaten',[ApiController::class,'getKabupaten']);
|
Loading…
Reference in New Issue