How to restore the old author stories page (solution inside!)

MellowJoe

Dude
Joined
Dec 23, 2018
Posts
45
First off, this is very much a work in progress, but it works well enough to be usable.

You will need to install the Tampermonkey browser extension. Get it here: https://www.tampermonkey.net/

Once you've installed Tampermonkey, click the link below. It should give you the option of installing the script.
If you've already installed it, you will be given the option to upgrade if it's a newer version.

https://github.com/JoeTheMellow/ReplaceAuthorWorks/raw/main/ReplaceAuthorWorks.user.js

How to use:

Click on the column headings to sort by title, rating, date, or category. Click again to sort in reverse order.

Issues:

If it's a series, I stick the series name in front of the chapter name. Makes it easier to sort, but can look a bit strange.

It can take a second or two to load, especially if it's a prolific author.

If you hit the back button to go back to the works page from a story, it will show the new style. Hit refresh to fix.

If you go to the works page from the author page, it may show the new style. Hit refresh to fix.


2024-07-12:
Fixed the link color to be a slightly lighter shade of blue that's more visible in dark mode.

Fixed the chapter names of multi-part stories. If the chapter starts with the actual series name, then that part of the chapter name is chopped off.
For example, if the series was named "Love Life of an Aardvark" and the first chapter was named "Love Life of an Aardvark Ch. 01", it would have
previously been titled on the page as "Love Life of an Aardvark 1 - Love Life of an Aardvark Ch. 01". Now it will be "Love Life of an Aardvark 1 - Ch. 01". It improved the look of things for the vast majority of series, but has a few quirks with a few of them. I think it was a worthwhile change.
 
Last edited:
Great script! Thank you for it, but it doesn't work on pages that have Poems and Stories. Can you please fix it?

1717720683940.png
 
Try this. It should also work with audio and artworks.

It got too big to put into a message here, so I had to put it on GitHub.

(link deleted - use the one in the first message)
 
Last edited:
Excellent script!!!! THANK YOU!

I've found a small problem on the following page:
https://www.literotica.com/authors/PAS/works/stories

1718737811518.png

This is clearly caused by wrong naming of chapters, but would it be great to enhance your script so that:
- Series are named without numbers, e.g.: Aimee's Wedding - Aimee's Wedding Ch. 3 (4.51)
hot08s.gif

- Sort each series by date

With this output here would be like this:
1718737868996.png

Not sure how much would this additional sorting slow down the script, but if it's not too much it might be worth a try.
 
It's that way on the old page, too. It comes out in that order from the API.

The way I sort, it wouldn't change if I took the numbers off the series name - "chapter 1" still comes after "ch 6".

There are other series out there that don't have chapter numbers in the chapter titles, or were posted out-of-order, so if I made those changes, they'd break.
 

Attachments

  • aw.png
    aw.png
    97.7 KB · Views: 4
Thanks, Your're right, I did not think of out of order posting, where sort by date could cause a real mess.
I guess authors should take care of correct naming and in this particular case it's immediatelly clear there is something out of order.

I've found another interesting page:
https://www.literotica.com/authors/INSATIABLESW/works/stories

There are 14 stories on this page, but on the top of the page it says 13 stories.
Seems that count is incorrect (problem with original page, not yours).

Funny thing, your script only shows 13 stories. I guess your script assumes that count is always correct?
Maybe it would make sense to count all the stories in the script?
 
Forget it, this looks like a problem with the site new design (I guess):
This author:
https://www.literotica.com/authors/kilroy44/
has 32 stories (accourding to the count on page)

There are indeed 32 stories when sorted by date:
https://www.literotica.com/authors/kilroy44/works/stories

But when sorted alfabetically there are 33 stories:
https://www.literotica.com/authors/kilroy44/works/stories?sort=name

The newest one (33rd) is only shown on alfabetically sorted page:
https://www.literotica.com/s/getting-to-the-pool-early-ch-15


Hope they will fix it soon.


Although, maybe your script could parse the alfabetically sorted page? :)



Anyway, did I mention that really apprecaite your work and it's really helpful, THANK YOU!
 
Forget it, this looks like a problem with the site new design (I guess):

I don't actually do any parsing of the page contents. I chuck the whole thing and rebuild it.

There's an API for querying Literotica and I just tap into that.

For example:
https://literotica.com/api/3/users/kilroy44/series_and_works?params={"page":1,"pageSize":5000,"type":"story","listType":"expanded"}

This grabs all of this author's stories (the first 5000 really) and returns a big json blob. The script parses through that and builds the table from scratch.

It also saves the story data in a hidden section of the page so that when you sort, it grabs from there instead of hitting the server again.

Problem is that the API is undocumented. I have to tease out what it does by hitting F12 to open the browser console and watch what the page does.

I have sometimes seen where that query doesn't return all of an author's stories.

Anyway, did I mention that really apprecaite your work and it's really helpful, THANK YOU!

You're welcome! I did it to scratch my own itch, but knew other people would find it useful.
 
I just played a little bit with this API and noticed the following:
when pagesize=5000 is used, than latest story here is not visible:
https://www.literotica.com/authors/Stories3882/works/stories

but if I reduce pagesize to 1000
then all the stories are visible.

Does it make sense to first check the number of stories on author main page:
https://www.literotica.com/authors/kilroy44

And then use that number with API?
(maybe add 10 stories, just in case if number of stories is not yet uptodate (like in the kilroy44 case)

just an idea :)
 
I thought about doing that because I hate hard-coding limits, but wanted to avoid an extra query.

I'm gonna do a script for the "favorites" pages next and I'll have to do it there, and will put it in this one, too.
 
Thanks!

What if you do a mixture of both?
First do a query with pagesize=500
and if you indeed get 500 stories, then use a query to get more precise pagesize?

I have a list of almost 400 favorite authors (don't ask) and only 3 of them have more than 500 stories:
SZENSEI
SusanJillParker
Azuldrgon

so I guess in general this wouldn't cause to many queries?
 
New version. Link in first message. It queries the count for each story type (story, poem, etc) and loads the stories 500 at a time.

Also added jump-to links to jump directly to the different types.
 
New version. Link in first message.

Fixed the link color to be a slightly lighter shade of blue that's more visible in dark mode.

Fixed the chapter names of multi-part stories. If the chapter starts with the actual series name, then that part of the chapter name is chopped off.
For example, if the series was named "Love Life of an Aardvark" and the first chapter was named "Love Life of an Aardvark Ch. 01", it would have
previously been titled on the page as "Love Life of an Aardvark 1 - Love Life of an Aardvark Ch. 01". Now it will be "Love Life of an Aardvark 1 - Ch. 01". It improved the look of things for the vast majority of series, but has a few quirks with a few of them. I think it was a worthwhile change.
 
I just noticed something strange, seems that date is one day behind:

1726290330566.png

1726290272183.png

It looks like this is the case on all pages.
 
Back
Top