Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seek: add column to CSV output for job content #2353

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Metrics/AbcSize:
Enabled: false

Metrics/BlockLength:
Max: 44
Max: 45

Metrics/CyclomaticComplexity:
Enabled: false
Expand Down
9 changes: 4 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GEM
colorator (1.1.0)
commonmarker (0.23.10)
concurrent-ruby (1.2.2)
connection_pool (2.4.0)
connection_pool (2.4.1)
csv (3.2.7)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
Expand Down Expand Up @@ -262,9 +262,9 @@ GEM
webrick (~> 1.7)
webrobots (~> 0.1.2)
mercenary (0.3.6)
mime-types (3.4.1)
mime-types (3.5.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.0218.1)
mime-types-data (3.2023.0808)
mini_portile2 (2.8.4)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
Expand Down Expand Up @@ -382,7 +382,6 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unf_ext (0.0.8.2-x64-mingw32)
unicode-display_width (2.4.2)
virtus (2.0.0)
axiom-types (~> 0.1)
Expand Down Expand Up @@ -426,4 +425,4 @@ DEPENDENCIES
tzinfo-data

BUNDLED WITH
2.4.6
2.4.19
12 changes: 7 additions & 5 deletions seek/seek.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def print_total_number_option(parser)
when FalseClass, NilClass, "no", "No", "NO"
false
else
value.to_s.downcase == "true" || value.to_s.downcase == "yes"
value.to_s.casecmp("true").zero? || value.to_s.casecmp("yes").zero?
end
end
end
Expand Down Expand Up @@ -207,7 +207,7 @@ def parse(args)
end
if options.print_total.nil?
print "Only print the total number of jobs found? (yes/no): "
options.print_total = $stdin.gets.chomp.downcase == "yes"
options.print_total = $stdin.gets.chomp.casecmp("yes").zero?
end

agent = Mechanize.new
Expand Down Expand Up @@ -236,7 +236,8 @@ def parse(args)
"Classification",
"Sub Classification",
# "Work Type",
"Short Description"
"Short Description",
"Content"
]

if options.print_total
Expand Down Expand Up @@ -277,7 +278,7 @@ def parse(args)
# listing_date = ad.at('dd[data-automation="job-detail-date"]').text if listing_date.empty?
get_script = ad.at('script[data-automation="server-state"]').text
salary = get_script.gsub(/(.*"jobSalary":")(.*?)(".*)/m, '\2') if salary.empty? && get_script.include?("jobSalary")

content = get_script.gsub(/(.*"content\(\{\\"platform\\":\\"WEB\\"\}\)":")(.*?)(".*")/m, '\2')
results <<
[
title,
Expand All @@ -290,7 +291,8 @@ def parse(args)
classification,
sub_classification,
# work_type,
short_description
short_description,
content
]
end

Expand Down