Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
Venjob_HungNT
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ngô Trung Hưng
Venjob_HungNT
Commits
92724316
Commit
92724316
authored
Jul 19, 2020
by
Ngo Trung Hung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
4f3e97eb
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
94 deletions
+104
-94
app/assets/javascripts/custom.js
+1
-1
app/assets/stylesheets/custom.scss
+52
-23
app/models/company.rb
+2
-2
app/views/home/_banner_and_search.html.erb
+1
-1
app/views/shared/_box_five_job.html.erb
+2
-0
lib/src/interface_web.rb
+46
-67
No files found.
app/assets/javascripts/custom.js
View file @
92724316
$
(
document
).
ready
(
function
()
{
$
(
document
).
on
(
"turbolinks:load"
,
function
()
{
$
(
'.btn_favorite_outline'
).
click
(
function
(
e
)
{
$
(
'.btn_favorite_outline'
).
click
(
function
(
e
)
{
$
(
this
).
toggleClass
(
'active'
);
$
(
this
).
toggleClass
(
'active'
);
});
});
...
...
app/assets/stylesheets/custom.scss
View file @
92724316
...
@@ -7,7 +7,7 @@ body {
...
@@ -7,7 +7,7 @@ body {
overflow
:
hidden
;
overflow
:
hidden
;
}
}
$breakpoint-tablet
:
9
2
2px
;
$breakpoint-tablet
:
9
9
2px
;
$main-color
:
#221f20
;
$main-color
:
#221f20
;
// Header
// Header
.cus_header
{
.cus_header
{
...
@@ -173,7 +173,7 @@ $main-color: #221f20;
...
@@ -173,7 +173,7 @@ $main-color: #221f20;
position
:
fixed
;
position
:
fixed
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
cursor
:
pointer
;
display
:
none
;
display
:
none
;
transition
:
0
.1s
;
transition
:
0
.1s
;
}
}
...
@@ -230,14 +230,14 @@ $main-color: #221f20;
...
@@ -230,14 +230,14 @@ $main-color: #221f20;
}
}
.slogan
{
.slogan
{
position
:
absolute
;
position
:
absolute
;
top
:
3
5
%
;
top
:
3
2
%
;
left
:
50%
;
left
:
50%
;
transform
:
translateX
(
-50%
);
transform
:
translateX
(
-50%
);
}
}
.slogan_text
{
.slogan_text
{
text-align
:
center
;
text-align
:
center
;
font-family
:
sans-serif
;
font-family
:
sans-serif
;
font-size
:
3
0
px
;
font-size
:
3
5
px
;
color
:
#eaeaea
;
color
:
#eaeaea
;
transform
:
scale
(
1
.35
);
transform
:
scale
(
1
.35
);
font-weight
:
600
;
font-weight
:
600
;
...
@@ -303,7 +303,7 @@ $main-color: #221f20;
...
@@ -303,7 +303,7 @@ $main-color: #221f20;
border
:
none
;
border
:
none
;
padding-left
:
16px
;
padding-left
:
16px
;
color
:
#666
;
color
:
#666
;
font-size
:
1
4
px
;
font-size
:
1
5
px
;
}
}
}
}
...
@@ -318,8 +318,7 @@ $main-color: #221f20;
...
@@ -318,8 +318,7 @@ $main-color: #221f20;
outline
:
none
;
outline
:
none
;
background-color
:
#fff
;
background-color
:
#fff
;
color
:
#666
;
color
:
#666
;
font-size
:
14px
;
font-size
:
15px
;
// font-weight: bold;
height
:
100%
;
height
:
100%
;
width
:
100%
;
width
:
100%
;
flex-basis
:
90%
;
flex-basis
:
90%
;
...
@@ -329,7 +328,7 @@ $main-color: #221f20;
...
@@ -329,7 +328,7 @@ $main-color: #221f20;
flex-basis
:
10%
;
flex-basis
:
10%
;
color
:
#999
;
color
:
#999
;
font-weight
:
100
;
font-weight
:
100
;
transform
:
scale
(
1
.2
)
translateY
(
1
3
px
);
transform
:
scale
(
1
.2
)
translateY
(
1
6
px
);
}
}
&
:
:
before
{
&
:
:
before
{
position
:
absolute
;
position
:
absolute
;
...
@@ -343,7 +342,7 @@ $main-color: #221f20;
...
@@ -343,7 +342,7 @@ $main-color: #221f20;
}
}
}
}
.search_industries
select
{
.search_industries
select
{
padding
:
12px
10px
12px
10
px
;
padding
:
12px
10px
12px
5
px
;
width
:
100%
;
width
:
100%
;
border-radius
:
4px
!
important
;
border-radius
:
4px
!
important
;
...
@@ -369,8 +368,7 @@ $main-color: #221f20;
...
@@ -369,8 +368,7 @@ $main-color: #221f20;
outline
:
none
;
outline
:
none
;
background-color
:
#fff
;
background-color
:
#fff
;
color
:
#666
;
color
:
#666
;
font-size
:
14px
;
font-size
:
15px
;
// font-weight: bold;
height
:
100%
;
height
:
100%
;
width
:
100%
;
width
:
100%
;
flex-basis
:
90%
;
flex-basis
:
90%
;
...
@@ -380,7 +378,7 @@ $main-color: #221f20;
...
@@ -380,7 +378,7 @@ $main-color: #221f20;
flex-basis
:
10%
;
flex-basis
:
10%
;
color
:
#999
;
color
:
#999
;
font-weight
:
100
;
font-weight
:
100
;
transform
:
scale
(
1
.2
)
translateY
(
1
3
px
);
transform
:
scale
(
1
.2
)
translateY
(
1
6
px
);
}
}
}
}
...
@@ -563,6 +561,7 @@ $main-color: #221f20;
...
@@ -563,6 +561,7 @@ $main-color: #221f20;
}
}
.slogan_text_h5
{
.slogan_text_h5
{
display
:
block
;
display
:
block
;
font-size
:
25px
;
}
}
.box-search-mobile
{
.box-search-mobile
{
display
:
block
;
display
:
block
;
...
@@ -590,7 +589,7 @@ $main-color: #221f20;
...
@@ -590,7 +589,7 @@ $main-color: #221f20;
height
:
160px
;
height
:
160px
;
}
}
.slogan_text_h5
{
.slogan_text_h5
{
font-size
:
16
px
;
font-size
:
24
px
;
font-weight
:
600
;
font-weight
:
600
;
}
}
}
}
...
@@ -615,7 +614,7 @@ $main-color: #221f20;
...
@@ -615,7 +614,7 @@ $main-color: #221f20;
.box_jobs
{
.box_jobs
{
position
:
relative
;
position
:
relative
;
width
:
100%
;
width
:
100%
;
height
:
13
0
px
;
height
:
13
4
px
;
margin
:
auto
;
margin
:
auto
;
margin-top
:
10px
;
margin-top
:
10px
;
margin-bottom
:
5px
;
margin-bottom
:
5px
;
...
@@ -639,7 +638,7 @@ $main-color: #221f20;
...
@@ -639,7 +638,7 @@ $main-color: #221f20;
transform
:
translateY
(
-1px
);
transform
:
translateY
(
-1px
);
}
}
.job_name
{
.job_name
{
font-size
:
1
4
px
;
font-size
:
1
6
px
;
line-height
:
14px
;
line-height
:
14px
;
font-weight
:
600
;
font-weight
:
600
;
color
:
#d41323
;
color
:
#d41323
;
...
@@ -650,9 +649,13 @@ $main-color: #221f20;
...
@@ -650,9 +649,13 @@ $main-color: #221f20;
text-decoration
:
none
;
text-decoration
:
none
;
}
}
}
}
.cop
{
background-color
:
white
;
margin-top
:
-5px
;
}
.box_info_copany_name
{
.box_info_copany_name
{
font-size
:
1
2
.5
px
;
font-size
:
1
4
px
;
line-height
:
12
.5
px
;
line-height
:
20
px
;
color
:
#666
;
color
:
#666
;
margin-top
:
5px
;
margin-top
:
5px
;
...
@@ -667,12 +670,12 @@ $main-color: #221f20;
...
@@ -667,12 +670,12 @@ $main-color: #221f20;
-webkit-box-orient
:
vertical
;
-webkit-box-orient
:
vertical
;
}
}
.box_info_location
{
.box_info_location
{
font-size
:
1
1
px
;
font-size
:
1
3
px
;
color
:
#666
;
color
:
#666
;
margin-top
:
5px
;
margin-top
:
5px
;
}
}
.box_info_salary
{
.box_info_salary
{
font-size
:
1
1
px
;
font-size
:
1
3
px
;
color
:
#008563
;
color
:
#008563
;
font-weight
:
600
;
font-weight
:
600
;
transform
:
translateY
(
-2px
);
transform
:
translateY
(
-2px
);
...
@@ -684,7 +687,7 @@ $main-color: #221f20;
...
@@ -684,7 +687,7 @@ $main-color: #221f20;
// background-color: #d41323;
// background-color: #d41323;
}
}
.coc
{
.coc
{
height
:
12px
;
height
:
12
.5
px
;
width
:
100%
;
width
:
100%
;
overflow
:
hidden
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
text-overflow
:
ellipsis
;
...
@@ -695,8 +698,8 @@ $main-color: #221f20;
...
@@ -695,8 +698,8 @@ $main-color: #221f20;
}
}
.box_info_des
{
.box_info_des
{
width
:
100%
;
width
:
100%
;
font-size
:
1
1
px
;
font-size
:
1
2
.5
px
;
line-height
:
12px
;
line-height
:
12
.5
px
;
color
:
#888
;
color
:
#888
;
margin
:
0
;
margin
:
0
;
}
}
...
@@ -735,7 +738,11 @@ $main-color: #221f20;
...
@@ -735,7 +738,11 @@ $main-color: #221f20;
.btn_favorite_outline.xs
{
.btn_favorite_outline.xs
{
display
:
none
;
display
:
none
;
}
}
@media
only
screen
and
(
min-width
:
$breakpoint-tablet
)
{
.btn_search_submit
{
width
:
101%
;
}
}
@media
only
screen
and
(
max-width
:
$breakpoint-tablet
)
{
@media
only
screen
and
(
max-width
:
$breakpoint-tablet
)
{
// index
// index
.padding_index
{
.padding_index
{
...
@@ -784,6 +791,7 @@ $main-color: #221f20;
...
@@ -784,6 +791,7 @@ $main-color: #221f20;
font-size
:
17px
;
font-size
:
17px
;
}
}
}
}
}
}
@media
only
screen
and
(
max-width
:
660px
)
{
@media
only
screen
and
(
max-width
:
660px
)
{
...
@@ -798,11 +806,32 @@ $main-color: #221f20;
...
@@ -798,11 +806,32 @@ $main-color: #221f20;
display
:
block
;
display
:
block
;
z-index
:
200
;
z-index
:
200
;
}
}
.cop
{
width
:
85%
;
height
:
24px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
display
:
-
webkit-box
;
-webkit-line-clamp
:
1
;
-webkit-box-orient
:
vertical
;
background-color
:
white
;
}
.btn_search_submit
{
height
:
30px
;
}
.search_industries_mobile
{
padding-right
:
4px
;
}
.search_location_mobile
{
padding-right
:
4px
;
}
}
}
@media
only
screen
and
(
max-width
:
576px
)
{
@media
only
screen
and
(
max-width
:
576px
)
{
.lol
{
.lol
{
width
:
80%
;
width
:
80%
;
}
}
}
}
app/models/company.rb
View file @
92724316
...
@@ -3,9 +3,9 @@ class Company < ApplicationRecord
...
@@ -3,9 +3,9 @@ class Company < ApplicationRecord
def
self
.
get_5_last_jobs
def
self
.
get_5_last_jobs
data
=
Company
.
joins
(
:jobs
).
select
(
'companies.*, jobs.name as job_title,
data
=
Company
.
joins
(
:jobs
).
select
(
'companies.*, jobs.name as job_title,
jobs.create
_date
as job_created,
jobs.create
d_at
as job_created,
jobs.salary,
jobs.salary,
jobs.description'
).
where
(
'companies.id = jobs.company_id'
)
jobs.description'
).
where
(
'companies.id = jobs.company_id'
)
@data_five_jobs
=
data
.
order
(
job_created: :
de
sc
).
limit
(
5
)
@data_five_jobs
=
data
.
order
(
job_created: :
a
sc
).
limit
(
5
)
end
end
end
end
app/views/home/_banner_and_search.html.erb
View file @
92724316
...
@@ -131,7 +131,7 @@
...
@@ -131,7 +131,7 @@
</div>
</div>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row no-gutters"
>
<div
class=
"row no-gutters"
>
<div
class=
"
offset-6 col-sm-6
"
>
<div
class=
"
col-sm-12
"
>
<button
type=
"submit"
class=
"btn_search_submit"
>
<button
type=
"submit"
class=
"btn_search_submit"
>
<i
class=
"fas fa-search"
></i>
<i
class=
"fas fa-search"
></i>
Tìm việc
Tìm việc
...
...
app/views/shared/_box_five_job.html.erb
View file @
92724316
...
@@ -18,7 +18,9 @@
...
@@ -18,7 +18,9 @@
<%=
link_to
"
#{
val
.
job_title
}
"
,
"#"
,
class:
"job_name"
%>
<%=
link_to
"
#{
val
.
job_title
}
"
,
"#"
,
class:
"job_name"
%>
<%=
image_tag
'trophy'
,
class:
"img_job_name"
%>
<%=
image_tag
'trophy'
,
class:
"img_job_name"
%>
</div>
</div>
<div
class =
"cop"
>
<h5
class=
"box_info_copany_name"
><i
class=
"far fa-building"
></i>
<%=
val
.
name
%>
</h5>
<h5
class=
"box_info_copany_name"
><i
class=
"far fa-building"
></i>
<%=
val
.
name
%>
</h5>
</div>
<h5
class=
"box_info_location"
><i
class=
"fas fa-map-marker-alt"
></i>
<%=
val
.
address
%>
</h5>
<h5
class=
"box_info_location"
><i
class=
"fas fa-map-marker-alt"
></i>
<%=
val
.
address
%>
</h5>
<h5
class=
"box_info_salary"
><i
class=
"fas fa-dollar-sign"
></i>
Lương:
<%=
val
.
salary
%>
</h5>
<h5
class=
"box_info_salary"
><i
class=
"fas fa-dollar-sign"
></i>
Lương:
<%=
val
.
salary
%>
</h5>
<div
class=
"coc"
>
<div
class=
"coc"
>
...
...
lib/src/interface_web.rb
View file @
92724316
...
@@ -21,10 +21,9 @@ class Interface_web
...
@@ -21,10 +21,9 @@ class Interface_web
data
<<
website_companies
<<
website_jobs
data
<<
website_companies
<<
website_jobs
end
end
@crawl_link_for_companies_jobs
=
crawl_link_for_companies_jobs
(
10
)
@crawl_link_for_companies_jobs
=
crawl_link_for_companies_jobs
(
7
)
def
self
.
get_link_job_and_companies
def
self
.
get_link_job_and_companies
@crawl_link_for_companies_jobs
||=
crawl_link_for_companies_jobs
(
10
)
@crawl_link_for_companies_jobs
||=
crawl_link_for_companies_jobs
(
7
)
end
end
def
self
.
base_link
(
url
)
def
self
.
base_link
(
url
)
...
@@ -69,16 +68,25 @@ class Interface_web
...
@@ -69,16 +68,25 @@ class Interface_web
@data_companies
@data_companies
end
end
add_data
=
proc
do
def
self
.
add_data
@data
[
:name
]
=
@name
@data
[
:company_name
]
=
@company_name
@data
[
:city_name
]
=
@city_name
@data
[
:created_date
]
=
@created_date
@data
[
:expiration_date
]
=
@expiration_date
@data
[
:salary
]
=
@salary
@data
[
:industry_name
]
=
@industry_name
@data
[
:description
]
=
@description
@data
[
:level
]
=
@level
@data
[
:exprience
]
=
@exprience
end
end
def
self
.
crawl_data_jobs_interface_1
(
url
)
def
self
.
crawl_data_jobs_interface_1
(
url
)
page
=
base_link
(
url
)
page
=
base_link
(
url
)
@name
<<
page
.
search
(
".apply-now-content .job-desc .title"
).
text
@name
<<
page
.
search
(
".apply-now-content .job-desc .title"
).
text
@data
[
:name
]
=
@name
@company_name
<<
page
.
search
(
".apply-now-content .job-desc .job-company-name"
).
text
@company_name
<<
page
.
search
(
".apply-now-content .job-desc .job-company-name"
).
text
@data
[
:company_name
]
=
@company_name
location
=
[]
location
=
[]
length
=
page
.
search
(
".detail-box .map p a"
).
size
length
=
page
.
search
(
".detail-box .map p a"
).
size
...
@@ -87,24 +95,18 @@ class Interface_web
...
@@ -87,24 +95,18 @@ class Interface_web
end
end
@city_name
<<
location
.
join
(
','
)
@city_name
<<
location
.
join
(
','
)
location
.
clear
location
.
clear
@data
[
:city_name
]
=
@city_name
@created_date
<<
page
.
search
(
".item-blue .detail-box:nth-child(1) ul li:nth-child(1) p"
)[
0
].
text
@created_date
<<
page
.
search
(
".item-blue .detail-box:nth-child(1) ul li:nth-child(1) p"
)[
0
].
text
@data
[
:created_date
]
=
@created_date
@expiration_date
<<
page
.
search
(
".item-blue .detail-box ul li:last"
)[
1
].
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
' '
).
last
@expiration_date
<<
page
.
search
(
".item-blue .detail-box ul li:last"
)[
1
].
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
' '
).
last
@data
[
:expiration_date
]
=
@expiration_date
@salary
<<
page
.
search
(
".item-blue .detail-box:nth-child(1) ul li:nth-child(1) p"
)[
1
].
text
@salary
<<
page
.
search
(
".item-blue .detail-box:nth-child(1) ul li:nth-child(1) p"
)[
1
].
text
@data
[
:salary
]
=
@salary
industry_name
=
page
.
search
(
".item-blue .detail-box:nth-child(1) ul li:nth-child(2) a"
).
text
industry_name
=
page
.
search
(
".item-blue .detail-box:nth-child(1) ul li:nth-child(2) a"
).
text
industry_name
=
industry_name
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
' '
).
select
{
|
v
|
v
!=
''
}
industry_name
=
industry_name
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
' '
).
select
{
|
v
|
v
!=
''
}
@industry_name
<<
industry_name
.
join
(
','
)
@industry_name
<<
industry_name
.
join
(
','
)
@data
[
:industry_name
]
=
@industry_name
@description
<<
page
.
search
(
".tabs .tab-content .detail-row:nth-child(n)"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@description
<<
page
.
search
(
".tabs .tab-content .detail-row:nth-child(n)"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@data
[
:description
]
=
@description
get_level
=
page
.
search
(
".item-blue .detail-box:last ul li:nth-child(3)"
).
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
lstrip
.
split
(
'Cấp bậc'
)
get_level
=
page
.
search
(
".item-blue .detail-box:last ul li:nth-child(3)"
).
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
lstrip
.
split
(
'Cấp bậc'
)
get_level
=
get_level
[
1
].
to_s
.
strip
get_level
=
get_level
[
1
].
to_s
.
strip
...
@@ -115,23 +117,20 @@ class Interface_web
...
@@ -115,23 +117,20 @@ class Interface_web
level
=
page
.
search
(
".item-blue .detail-box:last ul li:nth-child(3)"
).
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
lstrip
.
split
(
'Cấp bậc'
)
level
=
page
.
search
(
".item-blue .detail-box:last ul li:nth-child(3)"
).
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
lstrip
.
split
(
'Cấp bậc'
)
@level
<<
level
[
1
].
to_s
.
strip
@level
<<
level
[
1
].
to_s
.
strip
end
end
@data
[
:level
]
=
@level
exprience
=
page
.
search
(
".item-blue .detail-box:last ul li:nth-child(2)"
).
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
'Kinh nghiệm'
)
exprience
=
page
.
search
(
".item-blue .detail-box:last ul li:nth-child(2)"
).
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
'Kinh nghiệm'
)
exprience
=
exprience
[
1
].
to_s
.
strip
exprience
=
exprience
[
1
].
to_s
.
strip
@exprience
<<
exprience
@exprience
<<
exprience
@data
[
:exprience
]
=
@exprience
add_data
()
end
end
def
self
.
crawl_data_jobs_interface_2
(
url
)
def
self
.
crawl_data_jobs_interface_2
(
url
)
page
=
base_link
(
url
)
page
=
base_link
(
url
)
# page = Nokogiri::HTML(URI.open(URI.parse(URI.escape("https://careerbuilder.vn/vi/tim-viec-lam/dai-dien-tieu-thu-sales-representative-quang-binh-tp-dong-hoi.35B4572F.html"))))
@name
<<
page
.
search
(
".apply-now-content .job-desc .title"
).
text
@data
[
:name
]
=
@name
@name
<<
page
.
search
(
".apply-now-content .job-desc .title"
).
text
@company_name
<<
page
.
search
(
".top-job .top-job-info .tit_company"
).
text
@company_name
<<
page
.
search
(
".top-job .top-job-info .tit_company"
).
text
@data
[
:company_name
]
=
@company_name
location
=
[]
location
=
[]
length
=
page
.
search
(
".info-workplace .value a"
).
size
length
=
page
.
search
(
".info-workplace .value a"
).
size
...
@@ -140,71 +139,68 @@ class Interface_web
...
@@ -140,71 +139,68 @@ class Interface_web
end
end
@city_name
<<
location
.
join
(
','
)
@city_name
<<
location
.
join
(
','
)
location
.
clear
location
.
clear
@data
[
:city_name
]
=
@city_name
# @city_name << page.search(".info-workplace .value a").text
@created_date
<<
""
@created_date
<<
""
@data
[
:created_date
]
=
@created_date
expiration_date
=
page
.
search
(
".info li:nth-child(4)"
).
text
expiration_date
=
page
.
search
(
".info li:nth-child(4)"
).
text
if
expiration_date
==
""
@expiration_date
<<
""
else
@expiration_date
<<
expiration_date
.
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
' '
).
last
@expiration_date
<<
expiration_date
.
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
' '
).
last
@data
[
:expiration_date
]
=
@expiration_date
end
@salary
<<
page
.
search
(
".info li:nth-child(3)"
).
text
.
split
(
"Lương"
).
last
.
strip
@salary
<<
page
.
search
(
".info li:nth-child(3)"
).
text
.
split
(
"Lương"
).
last
.
strip
@data
[
:salary
]
=
@salary
@industry_name
<<
page
.
search
(
".info li:nth-child(5) .value"
).
text
@industry_name
<<
page
.
search
(
".info li:nth-child(5) .value"
).
text
@data
[
:industry_name
]
=
@industry_name
@description
<<
page
.
search
(
".left-col"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@description
<<
page
.
search
(
".left-col"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@data
[
:description
]
=
@description
@level
<<
page
.
search
(
".boxtp .info li:nth-child(2)"
).
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
lstrip
.
split
(
'Cấp bậc'
).
last
.
strip
lv
=
page
.
search
(
".boxtp .info li:nth-child(2)"
).
text
@data
[
:level
]
=
@level
if
lv
==
""
@level
<<
""
else
@level
<<
lv
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
strip
.
split
(
'Cấp bậc'
).
last
.
strip
end
@exprience
<<
page
.
search
(
".info li:nth-child(6)"
).
text
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
'Kinh nghiệm'
).
last
.
strip
exp
=
page
.
search
(
".info li:nth-child(6)"
).
text
@data
[
:exprience
]
=
@exprience
if
exp
==
""
@exprience
<<
""
else
@exprience
<<
exp
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
'Kinh nghiệm'
).
last
.
strip
end
add_data
()
end
end
def
self
.
crawl_data_jobs_interface_3
(
url
)
def
self
.
crawl_data_jobs_interface_3
(
url
)
page
=
base_link
(
url
)
page
=
base_link
(
url
)
@name
<<
page
.
search
(
".intro_job h1"
).
text
@name
<<
page
.
search
(
".intro_job h1"
).
text
@data
[
:name
]
=
@name
@company_name
<<
page
.
search
(
".info-company .text-job h2"
).
text
@company_name
<<
page
.
search
(
".info-company .text-job h2"
).
text
@data
[
:company_name
]
=
@company_name
@city_name
<<
page
.
search
(
".DetailJobNew ul li:nth-child(1) a"
).
text
@city_name
<<
page
.
search
(
".DetailJobNew ul li:nth-child(1) a"
).
text
@data
[
:city_name
]
=
@city_name
@created_date
<<
""
@created_date
<<
""
@data
[
:created_date
]
=
@created_date
@expiration_date
<<
page
.
search
(
".DetailJobNew .info ul li:nth-child(3) p"
).
text
.
strip
@expiration_date
<<
page
.
search
(
".DetailJobNew .info ul li:nth-child(3) p"
).
text
.
strip
@data
[
:expiration_date
]
=
@expiration_date
@salary
<<
page
.
search
(
".DetailJobNew .salary ul li:nth-child(3) p"
).
text
.
strip
@salary
<<
page
.
search
(
".DetailJobNew .salary ul li:nth-child(3) p"
).
text
.
strip
@data
[
:salary
]
=
@salary
@industry_name
<<
page
.
search
(
".DetailJobNew .salary ul li:nth-child(2) p"
).
text
.
strip
@industry_name
<<
page
.
search
(
".DetailJobNew .salary ul li:nth-child(2) p"
).
text
.
strip
@data
[
:industry_name
]
=
@industry_name
@description
<<
page
.
search
(
".content_job .detail-row"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@description
<<
page
.
search
(
".content_job .detail-row"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@data
[
:description
]
=
@description
@level
<<
page
.
search
(
".DetailJobNew .info ul li:nth-child(2) p"
).
text
.
strip
@level
<<
page
.
search
(
".DetailJobNew .info ul li:nth-child(2) p"
).
text
.
strip
@data
[
:level
]
=
@level
@exprience
<<
page
.
search
(
".DetailJobNew .info ul li:nth-child(1) p"
).
text
.
strip
@exprience
<<
page
.
search
(
".DetailJobNew .info ul li:nth-child(1) p"
).
text
.
strip
@data
[
:exprience
]
=
@exprience
add_data
()
end
end
def
self
.
crawl_data_jobs_interface_4
(
url
)
def
self
.
crawl_data_jobs_interface_4
(
url
)
page
=
base_link
(
url
)
page
=
base_link
(
url
)
@name
<<
page
.
search
(
".info-company h1"
).
text
@name
<<
page
.
search
(
".info-company h1"
).
text
@data
[
:name
]
=
@name
if
page
.
search
(
".zone-company .text-job h2"
).
text
==
""
if
page
.
search
(
".zone-company .text-job h2"
).
text
==
""
@company_name
<<
page
.
search
(
".info-company .text-job h2"
).
text
@company_name
<<
page
.
search
(
".info-company .text-job h2"
).
text
...
@@ -216,62 +212,46 @@ class Interface_web
...
@@ -216,62 +212,46 @@ class Interface_web
@industry_name
<<
industry_name
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
' '
).
select
{
|
v
|
v
!=
''
}
@industry_name
<<
industry_name
.
delete!
(
"[
\n
,
\t
,
\r
]"
).
split
(
' '
).
select
{
|
v
|
v
!=
''
}
end
end
@data
[
:company_name
]
=
@company_name
@data
[
:industry_name
]
=
@industry_name
@city_name
<<
page
.
search
(
".DetailJobNew ul li:nth-child(1) a"
).
text
@city_name
<<
page
.
search
(
".DetailJobNew ul li:nth-child(1) a"
).
text
@data
[
:city_name
]
=
@city_name
@created_date
<<
""
@created_date
<<
""
@data
[
:created_date
]
=
@created_date
@expiration_date
<<
page
.
search
(
".DetailJobNew li:nth-child(7) span"
).
text
@expiration_date
<<
page
.
search
(
".DetailJobNew li:nth-child(7) span"
).
text
@data
[
:expiration_date
]
=
@expiration_date
@salary
<<
page
.
search
(
".DetailJobNew li:nth-child(6) span"
).
text
@salary
<<
page
.
search
(
".DetailJobNew li:nth-child(6) span"
).
text
@data
[
:salary
]
=
@salary
@description
<<
page
.
search
(
".left-col"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@description
<<
page
.
search
(
".left-col"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@data
[
:description
]
=
@description
@level
<<
page
.
search
(
".DetailJobNew ul li:nth-child(2) span"
).
text
@level
<<
page
.
search
(
".DetailJobNew ul li:nth-child(2) span"
).
text
@data
[
:level
]
=
@level
@exprience
<<
""
@exprience
<<
""
@data
[
:exprience
]
=
@exprience
add_data
()
end
end
def
self
.
crawl_data_jobs_interface_5
(
url
)
def
self
.
crawl_data_jobs_interface_5
(
url
)
page
=
base_link
(
url
)
page
=
base_link
(
url
)
@name
<<
page
.
search
(
".info-company h1"
).
text
@name
<<
page
.
search
(
".info-company h1"
).
text
@data
[
:name
]
=
@name
@company_name
<<
page
.
search
(
".info-company .text-job h2"
).
text
@company_name
<<
page
.
search
(
".info-company .text-job h2"
).
text
@data
[
:company_name
]
=
@company_name
@city_name
<<
page
.
search
(
".DetailJobNew ul li:nth-child(1) a"
).
text
@city_name
<<
page
.
search
(
".DetailJobNew ul li:nth-child(1) a"
).
text
@data
[
:city_name
]
=
@city_name
@created_date
<<
""
@created_date
<<
""
@data
[
:created_date
]
=
@created_date
@expiration_date
<<
page
.
search
(
".DetailJobNew li:nth-child(9) span"
).
text
.
strip
@expiration_date
<<
page
.
search
(
".DetailJobNew li:nth-child(9) span"
).
text
.
strip
@data
[
:expiration_date
]
=
@expiration_date
@salary
<<
page
.
search
(
".DetailJobNew li:nth-child(3) span"
).
text
.
strip
@salary
<<
page
.
search
(
".DetailJobNew li:nth-child(3) span"
).
text
.
strip
@data
[
:salary
]
=
@salary
@industry_name
<<
page
.
search
(
".DetailJobNew li:nth-child(2) span"
).
text
.
strip
@industry_name
<<
page
.
search
(
".DetailJobNew li:nth-child(2) span"
).
text
.
strip
@data
[
:industry_name
]
=
@industry_name
@description
<<
page
.
search
(
".left-col .detail-row"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@description
<<
page
.
search
(
".left-col .detail-row"
).
to_s
.
delete!
(
"[
\n
,
\t
,
\r
]"
)
@data
[
:description
]
=
@description
@level
<<
page
.
search
(
".DetailJobNew ul li:nth-child(6) span"
).
text
.
strip
@level
<<
page
.
search
(
".DetailJobNew ul li:nth-child(6) span"
).
text
.
strip
@data
[
:level
]
=
@level
@exprience
<<
page
.
search
(
".DetailJobNew li:nth-child(5) span"
).
text
.
strip
@exprience
<<
page
.
search
(
".DetailJobNew li:nth-child(5) span"
).
text
.
strip
@data
[
:exprience
]
=
@exprience
add_data
()
end
end
def
self
.
make_data
def
self
.
make_data
...
@@ -292,16 +272,14 @@ class Interface_web
...
@@ -292,16 +272,14 @@ class Interface_web
page
=
Nokogiri
::
HTML
(
URI
.
open
(
URI
.
parse
(
URI
.
escape
(
"https://careerbuilder.vn/
#{
path
}
"
))))
page
=
Nokogiri
::
HTML
(
URI
.
open
(
URI
.
parse
(
URI
.
escape
(
"https://careerbuilder.vn/
#{
path
}
"
))))
if
page
.
search
(
".item-blue .detail-box:nth-child(1) ul li:nth-child(1) p"
)[
0
]
!=
nil
if
page
.
search
(
".item-blue .detail-box:nth-child(1) ul li:nth-child(1) p"
)[
0
]
!=
nil
crawl_data_jobs_interface_1
(
path
)
crawl_data_jobs_interface_1
(
path
)
elsif
page
.
search
(
".info li:nth-child(6)"
).
text
!=
""
crawl_data_jobs_interface_2
(
path
)
elsif
page
.
search
(
".DetailJobNew ul li"
).
size
==
10
elsif
page
.
search
(
".DetailJobNew ul li"
).
size
==
10
crawl_data_jobs_interface_5
(
path
)
crawl_data_jobs_interface_5
(
path
)
# elsif page.search(".DetailJobNew ul li").size == 8
# crawl_data_jobs_interface_4(path)
else
crawl_data_jobs_interface_3
(
path
)
end
end
end
end
@data
@data
end
end
end
end
# elsif page.search(".info li").text != ""
# crawl_data_jobs_interface_2(path)
# else # insert "page.search(".DetailJobNew ul li").size == 8" (if want catch interface 4)
# crawl_data_jobs_interface_3(path)
\ No newline at end of file
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