knighty / fimfiction-issues

Fimfiction Issue Tracker
27 stars 1 forks source link

Need consistent URL string for view_mode #183

Open DennoCoil opened 7 years ago

DennoCoil commented 7 years ago

(I feel stupid I didn't see this first on Knighty's page before messaging him. Reposting the PM I sent.)

TL;DR - Can you add to the URL string whenever someone is on the site, which view modes and pages you are on consistently?

I do have a minor feature request\bug to help with my book reading program, Calibre. https://en.wikipedia.org/wiki/Calibre_(software) There's an addon for it that's well supported called FanFicFare that's available for it. (The author is very active and is on this thread almost every day updating it. https://www.mobileread.com/forums/showthread.php?t=259221 ) The problem is FanFicFare doesn't support downloading group stories or whole bookshelves, only the generated page they have links on. (It's a generic scraper with individual custom modules for each fic site.) If I have a LOT of books on a bookshelf and wish to add them to Calibre, I can use the 60 story view mode for just the first page, but the subsequent pages are reset to 12 stories per page. The reason is I can do it for the first page with a URL like this:

https://www.fimfiction.net/bookshelf/XXXXXX/bookshelf2?view_mode=1

FanFicFare accepts and reads the 60 stories in it from that custom view mode, but only on the first page. As soon as I turn to the other page, the URL resets and turns into this.

https://www.fimfiction.net/bookshelf/XXXXXX/somebookshelf?page=2

Which puts it back onto the 12 page view_mode. I try adding ?view_mode=1 to various parts of the string on any page other than the first, and I get a 500 - Internal Server Error. With that, 1/6 of the possible stories I could add from my bookshelf is a time consuming chore.

I'd like to have the specific view modes become consistent between page URL strings on the bookshelf so FanFicFare can read and download a lot of stories appropriately without receiving a 500 error, like this:

https://www.fimfiction.net/bookshelf/XXXXXX/somebookshelf?page=2?view_mode=1

Lithl commented 7 years ago

?page=2?view_mode=1

This query string means page = "2?view_mode=1". Which is not a number, so the server doesn't know what page to give you.

You want ?page=2&view_mode=1, which means page = "2", view_mode = "1".

If the view_mode is resetting between pages, that's still a problem, but if you construct the query string correctly, at least you should be able to avoid code 500 errors.

DennoCoil commented 7 years ago

Yeah, I've only studied C++ and Python, and never looked into PHP. (That language looks like a bastard child between C and Java.) I've tried the string you've posted and it actually works. It doesn't show up in the URL when clicking on links, so it's still technically a minor bug that only very few would notice.

Just for reference, it looks like this properly: https://www.fimfiction.net/bookshelf/XXXXXX/somebookshelf?page=2&view_mode=1

Lithl commented 7 years ago

Query strings have nothing to do with php. It's part of the URI specification in RFC 3986.

DennoCoil commented 7 years ago

Then why does the string show up like that in the browser?