[devdocsgjs/main: 1748/1867] Fix and improve openjdk's get_latest_version




commit 3efd73ae406ca725054224d34c5a4300ac8739b6
Author: Enoc <brianhernandez222 hotmail com>
Date:   Tue Jul 6 23:11:14 2021 -0600

    Fix and improve openjdk's get_latest_version

 lib/docs/scrapers/openjdk.rb | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)
---
diff --git a/lib/docs/scrapers/openjdk.rb b/lib/docs/scrapers/openjdk.rb
index 411a328c..8d334f28 100644
--- a/lib/docs/scrapers/openjdk.rb
+++ b/lib/docs/scrapers/openjdk.rb
@@ -132,23 +132,11 @@ module Docs
     end
 
     def get_latest_version(opts)
-      latest_version = 8
-      current_attempt = latest_version
-      attempts = 0
-
-      while attempts < 3
-        current_attempt += 1
-
-        doc = fetch_doc("https://packages.debian.org/sid/openjdk-#{current_attempt}-doc";, opts)
-        if doc.at_css('.perror').nil?
-          latest_version = current_attempt
-          attempts = 0
-        else
-          attempts += 1
-        end
-      end
-
-      latest_version
+      doc = fetch_doc("https://jdk.java.net/archive/";, opts)
+      puts doc
+      version = doc.at_css('#downloads > table > tr > th').content
+      version.gsub!(/\(.*\)/, '')
+      version.gsub!(/[a-zA-z]/, '')
     end
   end
 end


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]