Sep 2025 posted_at fixes

This commit is contained in:
Dylan Knutson
2025-09-07 18:21:46 +00:00
parent 1905575d19
commit 7f7728366b
5 changed files with 2386 additions and 1 deletions

View File

@@ -170,7 +170,23 @@ class Domain::Fa::Parser::SubmissionParserHelper < Domain::Fa::Parser::Base
end end
when VERSION_2 when VERSION_2
date_str = @elem.css(".popup_date").first["title"] date_str = @elem.css(".popup_date").first["title"]
time_zone_offset.strptime(date_str, "%b %d, %Y %I:%M %p") if date_str if date_str
[
# version 2, pre September 2025 - formatted like "Jan 20, 2025 11:23 AM"
"%b %d, %Y %I:%M %p",
# version 2, post September 2025 - formatted like "September 7, 2025, 10:48:53"
"%B %e, %Y, %H:%M:%S",
].lazy
.map do |format|
begin
time_zone_offset.strptime(date_str, format)
rescue ArgumentError
nil
end
end
.find(&:present?) ||
raise(ArgumentError.new("invalid date string: `#{date_str}`"))
end
else else
raise("unimplemented version #{@page_version}") raise("unimplemented version #{@page_version}")
end end

View File

@@ -158,6 +158,35 @@ describe Domain::Fa::Job::ScanPostJob do
end end
end end
context "when scanning a post from the September 2025 update" do
let(:client_mock_config) do
[
{
uri: "https://www.furaffinity.net/view/62198493/",
status_code: 200,
content_type: "text/html",
contents:
SpecUtil.read_fixture_file(
"domain/fa/submission/submission_page_62198493_2025-09-07.html",
),
},
]
end
it "updates the post attributes" do
perform_now({ fa_id: 62_198_493 })
post = Domain::Post::FaPost.find_by(fa_id: 62_198_493)
expect(post.state).to eq("ok")
expect(post.title).to eq("harlan")
expect(post.creator).to eq(
Domain::User::FaUser.find_by(url_name: "charkiexd"),
)
expect(post.posted_at).to be_within(1.second).of(
Time.parse("Sep 6, 2025 9:07:01 PM -07:00"),
)
end
end
context "when scanning an already scanned post" do context "when scanning an already scanned post" do
include_context "post 59_714_213 already exists" include_context "post 59_714_213 already exists"
include_context "creator is creeps" include_context "creator is creeps"

View File

@@ -510,6 +510,40 @@ describe Domain::Fa::Parser::Page do
assert_equal 14, up.num_watching assert_equal 14, up.num_watching
end end
context "pages after the September 2025 update" do
it "works when posted_at is in the AM" do
parser =
get_parser_at(
Rails.root.join(
"test/fixtures/files/domain/fa/submission/submission_page_62203391_2025-09-07.html",
),
)
assert_page_type parser, :probably_submission?
sub = parser.submission
assert_equal 62_203_391, sub.id
assert_equal "alice_yagami", sub.artist
assert_equal "aliceyagami", sub.artist_url_name
assert_equal "/user/aliceyagami/", sub.artist_user_page_path
assert_equal "//d.furaffinity.net/art/aliceyagami/1757267333/1757267333.aliceyagami_silksong.jpg",
sub.small_img
assert_equal "//d.furaffinity.net/art/aliceyagami/1757267333/1757267333.aliceyagami_silksong.jpg",
sub.full_res_img
assert_equal Time.parse("Sep 7, 2025 10:48:53 -07:00"), sub.posted_date
end
it "works when posted_at is in the PM" do
parser =
get_parser_at(
Rails.root.join(
"test/fixtures/files/domain/fa/submission/submission_page_62198493_2025-09-07.html",
),
)
assert_page_type parser, :probably_submission?
sub = parser.submission
assert_equal Time.parse("Sep 6, 2025 9:07:01 PM -07:00"), sub.posted_date
end
end
context "recent gallery submission parsing" do context "recent gallery submission parsing" do
it "works when the user has recent gallery submissions" do it "works when the user has recent gallery submissions" do
parser = parser =

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff