Commit 750bd510 by Phạm Văn Đoan

cập nhật lấy bài hát ở keeng

parent 2f205883
...@@ -57,12 +57,17 @@ class KeengCrawlerNewRealeaseCommand extends Command ...@@ -57,12 +57,17 @@ class KeengCrawlerNewRealeaseCommand extends Command
$domain = config('api.keeng.domain'); $domain = config('api.keeng.domain');
$tracks = []; $tracks = [];
$index = 0; $index = 0;
for ($i = 1; $i <= 10; $i++) { for ($i = 1; $i <= 1; $i++) {
$url = getKeengUrlNewRealease($i); $url = getKeengUrlNewRealease($i);
$curl = cURL($url); $curl = cURL($url);
$data = json_decode($curl); $data = json_decode($curl);
if (isset($data->data)) { if (isset($data->data)) {
foreach ($data->data as $key => $track) { foreach ($data->data as $key => $track) {
$id_keeng = (isset($track->identify) && $track->identify != '') ? $track->identify : null;
if (empty($id_keeng)) {
$id_keeng = (isset($track->info_extra->identify)) ? $track->info_extra->identify : null;
}
//
$tracks[$index]['title'] = isset($track->name) ? $track->name : 'unknown-title'; $tracks[$index]['title'] = isset($track->name) ? $track->name : 'unknown-title';
$tracks[$index]['slug'] = isset($track->slug) ? $track->slug : null; $tracks[$index]['slug'] = isset($track->slug) ? $track->slug : null;
$tracks[$index]['userid'] = 0; $tracks[$index]['userid'] = 0;
...@@ -71,7 +76,7 @@ class KeengCrawlerNewRealeaseCommand extends Command ...@@ -71,7 +76,7 @@ class KeengCrawlerNewRealeaseCommand extends Command
$tracks[$index]['download_hash'] = md5($track->id); $tracks[$index]['download_hash'] = md5($track->id);
$tracks[$index]['time'] = time(); $tracks[$index]['time'] = time();
$tracks[$index]['link_keeng'] = isset($track->url) ? $track->url : null; $tracks[$index]['link_keeng'] = isset($track->url) ? $track->url : null;
$tracks[$index]['id_keeng'] = isset($track->identify) ? $track->identify : null; $tracks[$index]['id_keeng'] = $id_keeng;
$tracks[$index]['singer_list'] = isset($track->singer) ? $track->singer : null; $tracks[$index]['singer_list'] = isset($track->singer) ? $track->singer : null;
$tracks[$index]['composer_list'] = isset($track->info_extra->author_name) ? $track->info_extra->author_name : null; $tracks[$index]['composer_list'] = isset($track->info_extra->author_name) ? $track->info_extra->author_name : null;
$tracks[$index]['src_thumbnail'] = isset($track->image) ? $track->image : null; $tracks[$index]['src_thumbnail'] = isset($track->image) ? $track->image : null;
......
...@@ -68,6 +68,9 @@ class Kernel extends ConsoleKernel ...@@ -68,6 +68,9 @@ class Kernel extends ConsoleKernel
$schedule->command('nct:get-track')->dailyAt('13:10'); $schedule->command('nct:get-track')->dailyAt('13:10');
//$schedule->command('nhacvn:get-track')->dailyAt('13:20'); //$schedule->command('nhacvn:get-track')->dailyAt('13:20');
$schedule->command('keeng:get-track')->dailyAt('13:30'); $schedule->command('keeng:get-track')->dailyAt('13:30');
$schedule->command('keeng:get-new-release-track')->dailyAt('13:35');
// Cập nhật ảnh bài hát
$schedule->command('crawler:get-track-image')->dailyAt('13:40'); $schedule->command('crawler:get-track-image')->dailyAt('13:40');
// Cập nhật thông tin ca sĩ, nhạc sĩ sau 21h // Cập nhật thông tin ca sĩ, nhạc sĩ sau 21h
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment