Skip to content
Merged
Show file tree
Hide file tree
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
Watcher list page numbers were changed from 1-indexed to 0-indexed. F…
…or backwards compatibility, let's just subtract one when making the request. (I know, it seems a little horrible, but this application is full of horrible things done for backwards compatibility)
  • Loading branch information
Deer-Spangle committed Dec 11, 2025
commit 58c9e9606f710759eb8a025610a1f0fb6fb22946
1 change: 1 addition & 0 deletions lib/faexport/scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@

def budlist(name, page, is_watchers)
mode = is_watchers ? "to" : "by"
page = page - 1 # FA changed watchers list pages from being 1-indexed, to 0-indexed. So we have to convert to ensure backward compatibility.
url = "watchlist/#{mode}/#{escape(name)}/#{page}/"
html = fetch(url)

Expand Down Expand Up @@ -1318,7 +1319,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 +1339,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
3 changes: 3 additions & 0 deletions lib/faexport/views/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ Accounts that are watching or watched by the specified user.
By default, the first 200 users are returned.
You can pass a parameter `?page=2` to load more.

**Note:** The first page, and the default page, is page 1. Furaffinity has changed their site to zero-index pages, but
for backwards compatibility, FAExport continues to 1-index them.

*Formats:* `json`, `xml`

~~~json
Expand Down
Loading