Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xuan Trung Le
venjob
Commits
8d674ad5
Commit
8d674ad5
authored
Oct 05, 2017
by
Xuan Trung Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix data cralwer
parent
5c5c6c7b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
app/data/crawler.rb
+4
-2
app/models/job.rb
+13
-1
No files found.
app/data/crawler.rb
View file @
8d674ad5
...
...
@@ -31,7 +31,6 @@ class Crawler
params
=
{}
params_company
=
{}
description
=
[]
# get job's name
params
[
:name
]
=
doc
.
css
(
'.top-job .top-job-info h1'
).
text
.
strip
params
[
:updated_date
]
=
doc
.
css
(
'.datepost'
).
text
.
split
(
':'
)[
1
].
strip
...
...
@@ -77,10 +76,13 @@ class Crawler
def
self
.
crawl_company_infomation
(
doc
)
# get company information
params
=
{}
if
doc
.
css
(
'.box1Detail .TitleDetailNew span'
).
length
>
0
params
[
:name
]
=
doc
.
css
(
'.box1Detail .TitleDetailNew span'
).
text
params
[
:location
]
=
doc
.
css
(
'.box1Detail .TitleDetailNew label'
)[
0
].
text
params
[
:description
]
=
doc
.
css
(
'.desc_company p'
).
text
end
params
[
:name
]
||=
'Bảo mật'
return
params
end
...
...
app/models/job.rb
View file @
8d674ad5
...
...
@@ -17,11 +17,23 @@ class Job < ApplicationRecord
experience:
item
[
:experience
],
expiry_date:
item
[
:expiry_date
],
updated_date:
item
[
:updated_date
])
job
.
city
=
City
.
find_or_initialize_by
(
name:
(
item
[
:city
]
||=
''
).
split
(
':'
)[
0
])
#TODO fix this line
# City
unless
item
[
:city
].
blank?
job
.
city
=
City
.
find_or_create_by
(
name:
(
item
[
:city
]
||=
''
).
split
(
':'
)[
0
])
end
# Company
job
.
company
=
Company
.
find_or_initialize_by
(
name:
item
[
:company_name
])
job
.
company
.
location
=
item
[
:company_location
]
job
.
company
.
description
=
item
[
:company_description
]
job
.
company
.
city
=
job
.
city
# Industry
unless
item
[
:industry
].
blank?
item
[
:industry
].
split
(
','
).
each
do
|
name
|
job
.
industries
<<
Industry
.
find_or_create_by
(
name:
name
.
strip
)
end
end
job
.
save
end
end
...
...
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