mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.92k stars 975 forks source link

Furaffinity: Enable additional HTML-based filters for FuraffinitySearchExtractor #5459

Closed TiffanyNeat closed 7 months ago

TiffanyNeat commented 7 months ago

Due to the site's mandated limit on a max of 5000 parsable images per searching, I came up with a way to incorporate further usage of advanced search options into an HTML that you can then input into your web browser- and, potentially, this extractor- that works perfectly.

How I Found It: Go to Furaffinity on a web browser, go to the Search page, and below where it says "Sort Criteria", "Sort By Range", "Sort by Type", or "Sort by Matching Keywords" (if you're using Classic site look, you need to click the button labeled "Advanced" below the search bar), fiddle with ANY of those settings-- then, open up the Web Developer Console (note: I am using Firefox here so this is tailored to just how it looks there idk else's equivalents) & click the Network tab. THEN, click Search. A result at the top likely with the defined 'method' of POST & the indicator 'document' will pop up, containing the usual "/search" that follows the domain name in html. Click on it, then click on the 'Requests' tab. A few pink lines down, below the known-usual 'q: [tags]', is where you'll find the html-based inputs for how Furaffinity requests all other possible filterings on the site. This includes:

These can be inputted into an immediate html link by clicking on the button labelled 'Raw'. to the very right of where it says 'Form Data', to toggle it on. It'll generate a long line which you can copy & paste directly after '/search' in 'https://www.furaffinity.net/search/'. And it works, separating each filter by an '&' sign. For example, the total of the above would be https://www.furaffinity.net/search/reset_page=1&page=1&q=test&do_search=Search&order-by=relevancy&order-direction=asc&range=manual&range_from=2023-01-01&range_to=2024-03-23&rating-general=1&rating-mature=1&rating-adult=1&type-art=1&type-music=1&type-flash=1&type-story=1&type-photo=1&type-poetry=1&mode=all

The issue with the FuraffinitySearchExtractor is that it limits this by refusing anything beyond the 'q=QUERY' input, so this request is to extend it to be able to further input all other given datas here as well. Thanks, happy travels, and hope this doesn't immediately break with a website update or something! o/

mikf commented 7 months ago

The issue with the FuraffinitySearchExtractor is that it limits this by refusing anything beyond the 'q=QUERY' input

Well, no, it actually doesn't do that, but it expects URL path and query to be properly separated by an ?: /search?page=1&q=foo&…

https://www.furaffinity.net/search?reset_page=1&page=1&q=test&do_search=Search&order-by=relevancy&order-direction=asc&range=manual&range_from=2023-01-01&range_to=2024-03-23&rating-general=1&rating-mature=1&rating-adult=1&type-art=1&type-music=1&type-flash=1&type-story=1&type-photo=1&type-poetry=1&mode=all

TiffanyNeat commented 7 months ago

The issue with the FuraffinitySearchExtractor is that it limits this by refusing anything beyond the 'q=QUERY' input

Well, no, it actually doesn't do that, but it expects URL path and query to be properly separated by an ?: /search?page=1&q=foo&…

https://www.furaffinity.net/search?reset_page=1&page=1&q=test&do_search=Search&order-by=relevancy&order-direction=asc&range=manual&range_from=2023-01-01&range_to=2024-03-23&rating-general=1&rating-mature=1&rating-adult=1&type-art=1&type-music=1&type-flash=1&type-story=1&type-photo=1&type-poetry=1&mode=all

Tried this and it gave the same result in the extractor.

mikf commented 7 months ago

This definitely sends all parameters from reset_page=1 to mode=all as search arguments. Did you quote the URL since it contains ampersands?

gallery-dl "https://www.furaffinity.net/search?reset_page=1&page=1&q=test&do_search=Search&order-by=relevancy&order-direction=asc&range=manual&range_from=2023-01-01&range_to=2024-03-23&rating-general=1&rating-mature=1&rating-adult=1&type-art=1&type-music=1&type-flash=1&type-story=1&type-photo=1&type-poetry=1&mode=all"
TiffanyNeat commented 7 months ago

This definitely sends all parameters from reset_page=1 to mode=all as search arguments. Did you quote the URL since it contains ampersands?

gallery-dl "https://www.furaffinity.net/search?reset_page=1&page=1&q=test&do_search=Search&order-by=relevancy&order-direction=asc&range=manual&range_from=2023-01-01&range_to=2024-03-23&rating-general=1&rating-mature=1&rating-adult=1&type-art=1&type-music=1&type-flash=1&type-story=1&type-photo=1&type-poetry=1&mode=all"

...weird. that worked for me, when it 100% didn't before. Oh well. I'll just do it as you did and open this again if another oddity happens. Thanks for the help!