From 8e68e3393ba3bf74a6a044d4d2503d5d0db75c70 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Fri, 15 Sep 2023 20:59:59 +1000 Subject: [PATCH] seek: add column to CSV output for job content (#2353) * seek: add column to CSV output for job content --- .rubocop.yml | 2 +- Gemfile.lock | 9 ++++----- seek/seek.rb | 12 +++++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index af02c89ae..9c3351f65 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -31,7 +31,7 @@ Metrics/AbcSize: Enabled: false Metrics/BlockLength: - Max: 44 + Max: 45 Metrics/CyclomaticComplexity: Enabled: false diff --git a/Gemfile.lock b/Gemfile.lock index 8b8fb3122..d5fb81b92 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -426,4 +425,4 @@ DEPENDENCIES tzinfo-data BUNDLED WITH - 2.4.6 + 2.4.19 diff --git a/seek/seek.rb b/seek/seek.rb index 38ac45a3d..44b39e68c 100755 --- a/seek/seek.rb +++ b/seek/seek.rb @@ -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 @@ -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 @@ -236,7 +236,8 @@ def parse(args) "Classification", "Sub Classification", # "Work Type", - "Short Description" + "Short Description", + "Content" ] if options.print_total @@ -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, @@ -290,7 +291,8 @@ def parse(args) classification, sub_classification, # work_type, - short_description + short_description, + content ] end