also fix Twitter 429s
change
commit 4836ae6028a8d5ae3089c69de696977766a4575c
author Alpha Chen <alpha@kejadlen.dev>
date
parent dbe468fd
diff --git a/pinboard/refresh-pinboard-errors.rb b/pinboard/refresh-pinboard-errors.rb
index 7762ea2..d64c174 100755
--- a/pinboard/refresh-pinboard-errors.rb
+++ b/pinboard/refresh-pinboard-errors.rb
@@ -35,18 +35,12 @@ fill_in "username", with: ENV.fetch("PINBOARD_USERNAME")
 fill_in "password", with: ENV.fetch("PINBOARD_PASSWORD")
 click_button "log in"
 
-visit "https://pinboard.in/u:kejadlen/code:400"
-
-all(:xpath, "//a[@title='Click to re-crawl this link']").each do |link|
-  bookmark = link.find(:xpath, "../a[starts-with(@class, 'bookmark_title')]")
-  puts "Re-crawling #{bookmark.text}"
-  link.click
-end
-
-visit "https://pinboard.in/u:kejadlen/code:500"
-
-all(:xpath, "//a[@title='Click to re-crawl this link']").each do |link|
-  bookmark = link.find(:xpath, "../a[starts-with(@class, 'bookmark_title')]")
-  puts "Re-crawling #{bookmark.text}"
-  link.click
+[ 400, 429, 500 ].each do |error_code|
+  visit "https://pinboard.in/u:kejadlen/code:#{error_code}"
+
+  all(:xpath, "//a[@title='Click to re-crawl this link']").each do |link|
+    bookmark = link.find(:xpath, "../a[starts-with(@class, 'bookmark_title')]")
+    puts "Re-crawling #{bookmark.text}"
+    link.click
+  end
 end