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
d4050713
Commit
d4050713
authored
Apr 01, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tối ưu code lấy track từ NCT, xóa phần thừa
parent
904cf140
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
NctCrawlerTrackCommand.php
app/Console/Commands/Nct/NctCrawlerTrackCommand.php
+1
-1
Kernel.php
app/Console/Kernel.php
+2
-2
TrackRepository.php
app/Repositories/TrackRepository.php
+5
-5
No files found.
app/Console/Commands/Nct/NctCrawlerTrackCommand.php
View file @
d4050713
...
...
@@ -61,7 +61,7 @@ class NctCrawlerTrackCommand extends Command
$tracks
=
$this
->
trackRepository
->
processNctGetTrackInfoFromTop100
(
$url
);
$tracks_playlist
=
$this
->
trackRepository
->
processNctGetTrackInfoFromTop100Playlist
(
$url_playlist_top100
);
print_r
(
$tracks
);
return
false
;
if
(
count
(
$tracks
)
==
0
)
return
false
;
$key_insert
=
0
;
...
...
app/Console/Kernel.php
View file @
d4050713
...
...
@@ -85,9 +85,9 @@ class Kernel extends ConsoleKernel
$schedule
->
command
(
'crawler:get-listen zing --limit=-1'
)
->
dailyAt
(
'22:50'
);
$schedule
->
command
(
'calculate:daily-listen'
)
->
dailyAt
(
'1:00'
);
//
$schedule->command('calculate:daily-listen')->dailyAt('1:10');
$schedule
->
command
(
'calculate:daily-listen'
)
->
dailyAt
(
'1:10'
);
$schedule
->
command
(
'calculate:report daily'
)
->
dailyAt
(
'8:
54
'
);
$schedule
->
command
(
'calculate:report daily'
)
->
dailyAt
(
'8:
05
'
);
$schedule
->
command
(
'calculate:report weekly'
)
->
sundays
();
$schedule
->
command
(
'calculate:report monthly'
)
->
monthlyOn
(
21
,
'6:10'
);
...
...
app/Repositories/TrackRepository.php
View file @
d4050713
...
...
@@ -87,32 +87,32 @@ class TrackRepository extends BaseRepository
/* Lấy tên bài hát ------------------------------------------------------------------------------------------ */
$element_track_title
=
'div.box_info_field h3.h3 a'
;
foreach
(
$dom
->
find
(
$element_track_title
)
as
$data
)
{
$tracks
[
'title'
][]
=
str_replace
([
'<h2 class="card-header">'
,
'</h2>'
],
[
''
,
''
],
$data
->
innertext
);
$tracks
[
'title'
][]
=
str_replace
([
],
[
],
$data
->
innertext
);
}
/* Lấy đường dẫn ảnh của bài hát ---------------------------------------------------------------------------- */
$element_track_img
=
'div.box_info_field a img'
;
foreach
(
$dom
->
find
(
$element_track_img
)
as
$data
)
{
$tracks
[
'img'
][]
=
str_replace
([
'<h2 class="card-header">'
,
'</h2>'
],
[
''
,
''
],
$data
->
{
"data-src"
});
$tracks
[
'img'
][]
=
str_replace
([
],
[
],
$data
->
{
"data-src"
});
}
/* Lấy link bài hát ----------------------------------------------------------------------------------------- */
$element_track_link
=
'div.box_info_field h3.h3 a'
;
foreach
(
$dom
->
find
(
$element_track_link
)
as
$data
)
{
$link
=
str_replace
([
'<h2 class="card-header">'
,
'</h2>'
],
[
''
,
''
],
$data
->
href
);
$link
=
str_replace
([
],
[
],
$data
->
href
);
$tracks
[
'link'
][]
=
$link
;
}
/* Lấy tên ca sĩ hát ---------------------------------------------------------------------------------------- */
$element_track_singer
=
'div.box_info_field h4.list_name_singer a'
;
foreach
(
$dom
->
find
(
$element_track_singer
)
as
$data
)
{
$tracks
[
'singer'
][]
=
str_replace
([
'<h2 class="card-header">'
,
'</h2>'
],
[
''
,
''
],
$data
->
innertext
);
$tracks
[
'singer'
][]
=
str_replace
([
],
[
],
$data
->
innertext
);
}
/* Lấy url thông tin cá nhân ca sĩ -------------------------------------------------------------------------- */
$element_singer_profile
=
'div.box_info_field h4.list_name_singer a'
;
foreach
(
$dom
->
find
(
$element_singer_profile
)
as
$data
)
{
$tracks
[
'url_profile'
][]
=
str_replace
([
'<h2 class="card-header">'
,
'</h2>'
],
[
''
,
''
],
$data
->
href
);
$tracks
[
'url_profile'
][]
=
str_replace
([
],
[
],
$data
->
href
);
}
/* Lấy ID dạng chuỗi của bài hát ---------------------------------------------------------------------------- */
...
...
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