[devdocsgjs/main: 1453/1867] Fix broken get_latest_version implementations




commit c0290b816d50bdbeb18f75f3d1ac3f1755d9ff96
Author: Simon Legner <Simon Legner gmail com>
Date:   Sun Jan 3 10:27:43 2021 +0100

    Fix broken get_latest_version implementations

 lib/docs/scrapers/ansible.rb | 4 ++--
 lib/docs/scrapers/mdn/mdn.rb | 4 +---
 lib/docs/scrapers/numpy.rb   | 3 +--
 lib/docs/scrapers/vue.rb     | 2 +-
 4 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/lib/docs/scrapers/ansible.rb b/lib/docs/scrapers/ansible.rb
index d839095a..314da78f 100644
--- a/lib/docs/scrapers/ansible.rb
+++ b/lib/docs/scrapers/ansible.rb
@@ -75,8 +75,8 @@ module Docs
     end
 
     def get_latest_version(opts)
-      doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts)
-      doc.at_css('.version').content.strip
+      tags = get_github_tags('ansible', 'ansible', opts)
+      tags[0]['name'][1..-1]
     end
   end
 end
diff --git a/lib/docs/scrapers/mdn/mdn.rb b/lib/docs/scrapers/mdn/mdn.rb
index 31568fc7..128f850b 100644
--- a/lib/docs/scrapers/mdn/mdn.rb
+++ b/lib/docs/scrapers/mdn/mdn.rb
@@ -22,9 +22,7 @@ module Docs
     HTML
 
     def get_latest_version(opts)
-      json = fetch_json("https://developer.mozilla.org/en-US/docs/feeds/json/tag/#{options[:mdn_tag]}";, opts)
-      dates = json.map { |i| i['pubdate'] }
-      DateTime.parse(dates.max).to_time.to_i
+      get_latest_github_commit_date('mdn', 'content', opts)
     end
 
     private
diff --git a/lib/docs/scrapers/numpy.rb b/lib/docs/scrapers/numpy.rb
index 6b65b714..0ebe38dc 100644
--- a/lib/docs/scrapers/numpy.rb
+++ b/lib/docs/scrapers/numpy.rb
@@ -66,8 +66,7 @@ module Docs
     end
 
     def get_latest_version(opts)
-      html = fetch('https://docs.scipy.org/doc/', opts)
-      html.scan(/Numpy ([0-9.]+) Reference Guide/)[0][0]
+      get_latest_github_release('numpy', 'numpy', opts)
     end
   end
 end
diff --git a/lib/docs/scrapers/vue.rb b/lib/docs/scrapers/vue.rb
index 8cf48242..9f90f9bf 100644
--- a/lib/docs/scrapers/vue.rb
+++ b/lib/docs/scrapers/vue.rb
@@ -34,7 +34,7 @@ module Docs
     end
 
     def get_latest_version(opts)
-      get_latest_github_release('vuejs', 'vue', opts)
+      get_latest_github_release('vuejs', 'vue-next', opts)
     end
   end
 end


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