tessmonical / ao3-bookmark-getter

A script to quickly get all public AO3 bookmark URLs from your account
17 stars 2 forks source link

Adding Fandoms to data #8

Open evelynmaire opened 2 years ago

evelynmaire commented 2 years ago

Hi there! I know this project is likely archived, but I was wondering if there's a chance of adding what fandom the work is from to the data displayed? Thanks for your hard work!

syrtis-m commented 2 years ago

Hello! I've just implemented this feature (and printing with word counts) on my fork. It does require the additional ao3_api package, which is installed the same way as requests. Unfortunately, it takes a really long time to load the works with fandom metadata due to the ao3_api package not working great - something I hope to fix in a future update by doing a full rewrite to add multithreading.

Hopefully this helps! If you run into an error, let me know.

evelynmaire commented 2 years ago

That's amazing, thank you so much!

evelynmaire commented 2 years ago

Thanks so much for the update, it's working fantastic for what I need, with one small query.

When it displays the data, it seems to replace the last letter of text lines (ie. not the url or word count with numbers at the end) with quotation marks;

(I'm exposing my taste in fic here, please no judgment haha)

b'tle: Delug'
word count: 50565
b'ndoms: Merlin (TV'
url: http://archiveofourown.org/works/19368574

b'tle: guessing game'
word count: 8345
b"ndoms: ???????? - ???? | The Scum Villain's Self-Saving System - M?xi?ng T?ngxi"
url: http://archiveofourown.org/works/33497887

(the ??? are expected, as they're non utf-8 characters)

The last words should read Deluge Merlin (TV) guessing games Moxiang Tongxiu

This isn't a massive problem, and it might be something I've done wrong. I certainly learned a lot more about python today bc my modules (?) are being installed in a different folder than python's path seems to be pointing to? So not sure if it's something wacky on my end.

syrtis-m commented 2 years ago

That error was absolutely the fault of my code, I've pushed a fixed version to my repo.

(No judgment on the fic taste lol)

 title: Sleepovers, Snuggles, and Sexuality Crises
word count: 2529
fandoms:Infinity Train (Cartoon)
url: http://archiveofourown.org/works/34732672

title: there's piracy in the lyrics (so lie like they're your own)
word count: 176801
fandoms:??????????? | Boku no Hero Academia | My Hero Academia
url: http://archiveofourown.org/works/24672157

I was using .encode() to handle non-ascii characters because python had been throwing errors when it tried to print them. I went and reread the documentation for .encode() - apparently it makes a string into a bytes object - that's why it had the b' at the beginning and ' at the end. I found out that there's a .decode() function to turn the bytes object back into a string, which fixed the weird formatting.

evelynmaire commented 2 years ago

That's awesome, thanks so much for the quick response!! That works perfectly now :)