Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Turns out watchers list isn't zero indexed, but now you can't trust t…
…hat page 1 displays the same as the default page if there are no watchers
  • Loading branch information
Deer-Spangle committed Dec 11, 2025
commit aedad81b05ddd07bf5f1a8510f36d1867a212ae4
6 changes: 5 additions & 1 deletion lib/faexport/scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,11 @@

def budlist(name, page, is_watchers)
mode = is_watchers ? "to" : "by"
url = "watchlist/#{mode}/#{escape(name)}/#{page}/"
if page == 1
url = "watchlist/#{mode}/#{escape(name)}/"
else
url = "watchlist/#{mode}/#{escape(name)}/#{page}/"
end
html = fetch(url)

html.at_css("td.alt1").css(".c-usernameBlockSimple__displayName").map(&:content)
Expand Down Expand Up @@ -1318,7 +1322,7 @@
rescue OpenURI::HTTPError => e
$http_errors.increment(labels: { page_type: page_type })
# Detect and handle known errors
if e.io.status[0] == "403" || e.io.status[0] == "503" || e.io.status[0] == "400"
raw = e.io.read
html = Nokogiri::HTML(raw.encode("UTF-8", invalid: :replace, undef: :replace).delete("\000"))

Expand All @@ -1338,7 +1342,7 @@
# Handle user not found errors
if e.io.status[0] == "400"
head = html.xpath("//head//title").first
if head.content == "System Error"
error_msg = html.at_css("table.maintable td.alt1 font").content
# Handle user profile not found, and user not found on journal listing
if error_msg.include?("This user cannot be found") || error_msg.include?("User not found!")
Expand Down
Loading