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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
Thanh Hung Pham
veNJOB
Commits
e3fd63c3
Commit
e3fd63c3
authored
Jul 03, 2017
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move import area data to db:seed
parent
fa55f791
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
10 deletions
+2
-10
db/seeds.rb
+2
-0
lib/tasks/careerbuilder.rb
+0
-10
No files found.
db/seeds.rb
View file @
e3fd63c3
...
...
@@ -5,3 +5,5 @@
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
Area
.
new
(
name:
'Viet Nam'
).
save
Area
.
new
(
name:
'International'
).
save
lib/tasks/careerbuilder.rb
View file @
e3fd63c3
...
...
@@ -19,7 +19,6 @@ class Careerbuilder
@logger
.
info
(
'Start crawl'
)
doc
=
Nokogiri
::
HTML
(
open
(
'http://careerbuilder.vn'
))
import_area
import_category
(
doc
)
import_city
(
doc
)
...
...
@@ -127,15 +126,6 @@ class Careerbuilder
end
end
def
import_area
Area
.
new
(
name:
'Viet Nam'
).
save
if
Area
.
where
(
name:
'Viet Nam'
).
blank?
Area
.
new
(
name:
'International'
).
save
if
Area
.
where
(
name:
'International'
).
blank?
rescue
StandardError
=>
e
logger
.
error
(
"[method: ]
#{
import_category
}
"
)
logger
.
error
(
e
.
message
)
logger
.
error
(
e
.
backtrace
)
end
def
import_category
(
doc
)
categories
=
doc
.
xpath
(
"//div[@class='s-home2']/div[@id='NewSearchJob3']/form/div[@class='search-horizontal']/div[@class='ui-widget box_multiSelect_industry']/select/option"
)
categories
=
categories
.
slice
(
1
..
categories
.
size
-
2
)
...
...
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