Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crawler.vmusicchart.vn
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Phạm Văn Đoan
crawler.vmusicchart.vn
Commits
bbcb095e
Commit
bbcb095e
authored
Jun 03, 2021
by
doan281
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cập nhật code
parent
ed4c258c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
170 additions
and
12 deletions
+170
-12
.env
.env
+4
-1
QuestionCommand.php
app/Console/Commands/Gameshow/QuestionCommand.php
+88
-0
YoutubeCrawlerListenCommand.php
app/Console/Commands/Youtube/YoutubeCrawlerListenCommand.php
+13
-5
Kernel.php
app/Console/Kernel.php
+3
-4
Answer.php
app/Models/Gameshow/Answer.php
+15
-0
Question.php
app/Models/Gameshow/Question.php
+25
-0
Topic.php
app/Models/Gameshow/Topic.php
+20
-0
app.php
config/app.php
+2
-2
No files found.
.env
View file @
bbcb095e
APP_NAME=Laravel
APP_ENV=
production
APP_ENV=
localhost
#APP_ENV=production/localhost
APP_KEY=base64:OnxDnOd5hyBzqzaoj1c+yl17+9lQiallMbwKuitg4XU=
APP_DEBUG=true
...
...
@@ -41,3 +41,6 @@ MAIL_FROM_NAME=VMusicChart.Vn
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
# YOUTUBE_API_KEY=AIzaSyAEPc-G8kluV2MZinW6CzP24T9Jk_In2aw
YOUTUBE_API_KEY=AIzaSyAoiNPZC26cXgNAz-s7Shqav5KuIL0BZ_8
app/Console/Commands/Gameshow/QuestionCommand.php
0 → 100644
View file @
bbcb095e
<?php
namespace
App\Console\Commands\Gameshow
;
use
App\Models\Gameshow\Answer
;
use
App\Models\Gameshow\Question
;
use
App\Models\Gameshow\Topic
;
use
Illuminate\Console\Command
;
class
QuestionCommand
extends
Command
{
protected
$question
;
protected
$topic
;
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'gameshow:question'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'Command description'
;
/**
* Create a new command instance.
*
* @return void
*/
public
function
__construct
()
{
parent
::
__construct
();
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
(
Question
$question
,
Topic
$topic
)
{
$this
->
question
=
$question
;
$this
->
topic
=
$topic
;
$query
=
Question
::
select
()
->
with
([
'topics'
=>
function
(
$sql
)
{
//$sql->select(['topics.id','topics.name'])->take(2);
$sql
->
select
([
'topics.id'
,
'topics.name'
]);
}
])
->
withCount
(
'topics'
)
->
get
()
->
toArray
();
print_r
(
$query
);
$result
=
collect
(
$query
)
->
map
(
function
(
$item
){
})
->
all
();
$q
=
Question
::
select
(
'*'
)
->
with
([
'answers'
=>
function
(
$sql
){
$sql
->
select
([
'answers.id'
,
'answers.name'
]);
}
])
->
get
()
->
toArray
();
print_r
(
$q
);
/*$as = Answer::select('*')->with([
'question' => function($sql){
$sql->select(['id', 'name']);
}
])->get()->toArray();
print_r($as);*/
}
}
app/Console/Commands/Youtube/YoutubeCrawlerListenCommand.php
View file @
bbcb095e
...
...
@@ -41,14 +41,22 @@ class YoutubeCrawlerListenCommand extends Command
*/
public
function
handle
()
{
echo
'OK'
;
$url
=
'https://www.youtube.com/watch?v=8mC7oNkz9t4'
;
//$url = 'https://www.youtube.com/watch?v=8mC7oNkz9t4';
//$video = Youtube::getVideoInfo('8mC7oNkz9t4
');
$video
=
Youtube
::
getVideoInfo
(
'UqKVL56IJB8
'
);
//print_r($video);
$data
=
[
'id'
=>
$video
->
id
,
'published_at'
=>
date
(
'Y-m-d H:I:s'
,
strtotime
(
$video
->
snippet
->
publishedAt
)),
'title'
=>
$video
->
snippet
->
title
,
'thumbnails'
=>
$video
->
snippet
->
thumbnails
->
standard
->
url
,
'duration'
=>
$video
->
contentDetails
->
duration
,
'view_count'
=>
$video
->
statistics
->
viewCount
,
];
echo
Hash
::
make
(
'123456a@A'
);
print_r
(
$data
);
//echo Hash::make('123456a@A');
...
...
app/Console/Kernel.php
View file @
bbcb095e
...
...
@@ -14,7 +14,7 @@ use App\Console\Commands\Nct\NctCrawlerTrackCommand;
use
App\Console\Commands\NhacVn\NhacVnCrawlerTrackCommand
;
use
App\Console\Commands\SendWarningCommand
;
use
App\Console\Commands\Update\UpdateTrackArtistCommand
;
use
App\Console\Commands\Y
nv\Ynv
Command
;
use
App\Console\Commands\Y
outube\YoutubeCrawlerListen
Command
;
use
App\Console\Commands\Zing\ZingCrawlerNewRealeaseCommand
;
use
App\Console\Commands\Zing\ZingCrawlerTrackCommand
;
use
App\Console\Commands\CrawlerTrackImageCommand
;
...
...
@@ -30,7 +30,7 @@ class Kernel extends ConsoleKernel
*/
protected
$commands
=
[
CrontjobCommand
::
class
,
Y
nv
Command
::
class
,
Y
outubeCrawlerListen
Command
::
class
,
ZingCrawlerTrackCommand
::
class
,
ZingCrawlerNewRealeaseCommand
::
class
,
...
...
@@ -109,8 +109,7 @@ class Kernel extends ConsoleKernel
$schedule
->
command
(
'send:email warning_weekly_report'
)
->
dailyAt
(
'8:05'
);
$schedule
->
command
(
'send:email warning_monthly_report'
)
->
dailyAt
(
'8:10'
);
// Gửi mail nhắc nhở check CMS hàng ngày trước 9h
// Tạm dừng gửi vì đã triển khai lên hệ thống khác
//$schedule->command('send:email daily_checking')->dailyAt('9:01');
$schedule
->
command
(
'send:email daily_checking'
)
->
dailyAt
(
'9:01'
);
$schedule
->
command
(
'queue:work --once --timeout=120'
)
->
everyMinute
()
->
withoutOverlapping
();
}
...
...
app/Models/Gameshow/Answer.php
0 → 100644
View file @
bbcb095e
<?php
namespace
App\Models\Gameshow
;
use
Illuminate\Database\Eloquent\Model
;
class
Answer
extends
Model
{
protected
$table
=
'answers'
;
public
function
question
()
{
return
$this
->
belongsTo
(
'App\Models\Gameshow\Question'
,
'question_id'
,
'id'
);
}
}
app/Models/Gameshow/Question.php
0 → 100644
View file @
bbcb095e
<?php
namespace
App\Models\Gameshow
;
use
Illuminate\Database\Eloquent\Model
;
class
Question
extends
Model
{
protected
$table
=
'questions'
;
public
function
topics
()
{
return
$this
->
belongsToMany
(
'App\Models\Gameshow\Topic'
,
'question_topic'
,
'question_id'
,
'topic_id'
);
}
public
function
answers
()
{
return
$this
->
hasMany
(
'App\Models\Gameshow\Answer'
,
'question_id'
,
'id'
);
}
}
app/Models/Gameshow/Topic.php
0 → 100644
View file @
bbcb095e
<?php
namespace
App\Models\Gameshow
;
use
Illuminate\Database\Eloquent\Model
;
class
Topic
extends
Model
{
protected
$table
=
'topics'
;
public
function
topics
()
{
return
$this
->
belongsToMany
(
'App\Models\Gameshow\Question'
,
'question_topic'
,
'topic_id'
,
'question_id'
);
}
}
config/app.php
View file @
bbcb095e
...
...
@@ -170,7 +170,7 @@ return [
Yangqi\Htmldom\HtmldomServiceProvider
::
class
,
Maatwebsite\Excel\ExcelServiceProvider
::
class
,
Ixudra\Curl\CurlServiceProvider
::
class
,
//
Alaouy\Youtube\YoutubeServiceProvider::class,
Alaouy\Youtube\YoutubeServiceProvider
::
class
,
/*
* Application Service Providers...
...
...
@@ -234,7 +234,7 @@ return [
'Htmldom'
=>
Yangqi\Htmldom\Htmldom
::
class
,
'Excel'
=>
Maatwebsite\Excel\Facades\Excel
::
class
,
'Curl'
=>
Ixudra\Curl\Facades\Curl
::
class
,
//
'Youtube' => Alaouy\Youtube\Facades\Youtube::class,
'Youtube'
=>
Alaouy\Youtube\Facades\Youtube
::
class
,
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment