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
3254574e
Commit
3254574e
authored
Jul 20, 2020
by
Ngô Trung Hưng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
658c19e7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
lib/src/crawler.rb
+3
-3
lib/src/interface_web.rb
+4
-1
lib/tasks/crawler.rake
+1
-1
No files found.
lib/src/crawler.rb
View file @
3254574e
...
...
@@ -47,12 +47,11 @@ class Clawler
address:
"Vui lòng xem trong mô tả công việc"
,
short_description:
"Vui lòng xem trong mô tả công việc"
)
@data
=
Interface_web
.
craw_data_companies
()
puts
'Save info companies to database . . .'
i
=
@data
[
:name
].
length
i
.
times
do
|
n
|
name
=
@data
[
:name
][
n
]
if
Company
.
find_by
(
"name = ?"
,
name
)
next
else
unless
Company
.
find_by
(
name:
name
).
present?
address
=
@data
[
:address
][
n
]
short_description
=
@data
[
:description
][
n
]
Company
.
create!
(
name:
name
,
...
...
@@ -65,6 +64,7 @@ class Clawler
def
self
.
make_jobs
Job
.
update_all
(
newdata:
0
)
@data_jobs
=
Interface_web
.
make_data
()
puts
'Save to database . . .'
i
=
@data_jobs
[
:name
].
length
i
.
times
do
|
n
|
name
=
@data_jobs
[
:name
][
n
].
to_s
...
...
lib/src/interface_web.rb
View file @
3254574e
...
...
@@ -36,7 +36,8 @@ class Interface_web
@data_companies_name
=
[]
@data_companies_address
=
[]
@data_companies_description
=
[]
puts
'Crawl data companies'
@current_company
=
0
link_crawl
[
0
].
each
do
|
url
|
page
=
base_link
(
url
)
name
=
''
...
...
@@ -56,7 +57,9 @@ class Interface_web
@data_companies_name
<<
name
.
to_s
.
rstrip
@data_companies_address
<<
address
.
to_s
.
rstrip
@data_companies_description
<<
desc
@current_company
+=
1
end
puts
"Crawling
#{
@current_company
}
"
end
@data_companies
[
:name
]
=
@data_companies_name
@data_companies
[
:address
]
=
@data_companies_address
...
...
lib/tasks/crawler.rake
View file @
3254574e
...
...
@@ -4,6 +4,6 @@ namespace :db do
# Clawler.make_industries
# Clawler.make_cities
Clawler
.
make_companies
Clawler
.
make_jobs
#
Clawler.make_jobs
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