Simon-Tesla / RaccoonyWebEx

A WebExtension that adds shiny features to art sites
MIT License
44 stars 4 forks source link

[FurAffinity] Saves thumbnails rather than story. #46

Closed ChakatFirepaw closed 4 years ago

ChakatFirepaw commented 4 years ago

Describe the bug With the new FA version, using Raccoony to save a story results in the thumbnail being saved rather than the story.

To Reproduce Steps to reproduce the behavior: Open a story with a thumnail. Hit 'save' hotkey

Expected behavior The story should be what is saved.

Environment (please complete the following information):

Eupeptic1 commented 4 years ago

I believe this same bug, or a very similar one, also affects music submissions; you just get the thumbnail image, and not an mp3 (or similar) file. Raccoony also identifies the submitter as "music", rather than their FA profile name.

Example: Use Raccoony to download from https://www.furaffinity.net/view/35116168/ .

Expected result: MP3 file on local disk named something close to ~/Downloads/raccoony/furaffinity/kavaeric/1582154898_seven_hundred_years_by_kavaeric.mp3

Actual result: JPEG file on local disk named ~/Downloads/raccoony/furaffinity/music/1582154898_thumbnail.kavaeric_seven_hundred_years.mp3_by_music.jpg .

This is with Raccoony 1.2.2 and Firefox Quantum 68.4.1esr, 64-bit, on Linux desktop.

Eupeptic1 commented 4 years ago

Analysis

I can reproduce this bug, both for stories (as originally reported), and for music.

On the new FA UI (in production since about 2019-12-31), Raccoony's FA plugin can't find the "download" button URL anymore, at least for images, stories, and music submissions. getMediaURLs() always falls through to the // If all else fails... section, which only looks for an image. If the submission really is an image, this ends up doing the right thing, but if it's a story or music, it ends up getting the thumbnail image, rather than the story or song.

The challenge is to fix this in Raccoony for the new FA UI, without breaking anything in the old FA UI. Justification: some of the critters I follow have said they still use the old UI.

This is with Raccoony 1.2.2 and Firefox Quantum 68.4.1esr, 64-bit, on Linux desktop.

Eupeptic1 commented 4 years ago

Fix

Proof-of-concept fix here.

Changes

I changed the selector in getMediaUrls() to '.submission-sidebar .buttons .download a', to match the structure of the new FA UI.

I also changed the parsing of URLs in getMedia() to work better for music and stories. Both of those submission types have an extra piece in the URL, that plain old image submissions don't have - this is why Raccoony thought the author of stories was named "story" and the author of music was named "music".

Testing

On one image, one .mp3 audio, one text story, and one PDF story. It seems to do the right thing in those four cases. I also turned on the metadata file download, and the metadata appears to be parsed correctly.

Notes

This doesn't have any changes related to #44, although the comments should make it clearer where to fix #44 if desired.

It still has a lot of logging statements; some of them can probably be removed for production.