CanineAnimal / Quincentenary-Archive

For archiving threads on the NationStates Forum 7 board that get past 500 pages!
GNU General Public License v3.0
0 stars 0 forks source link

A couple of improvement suggestions. #1

Closed Clarissa-Valentine-Z closed 1 year ago

Clarissa-Valentine-Z commented 1 year ago

Actually nice code, I am using it after I added in my name as the requester / user of the code. Thanks!

A couple of suggestions, if I may:

# Get inputs
threadLink = "https://forum.nationstates.net/viewtopic.php?f=25&t=415231"
pageNo = 501
tn = "Guess the AN religion by it's flag"

# Check whether the specified path exists or not
output_folder = "./%s" % str(tn)
isExist = os.path.exists(output_folder)

# Create a new directory because it does not exist
if not isExist:
    os.makedirs(output_folder)

I can't test out the PDF saving, exception on my side; trying to work out my virtual env on what's wrong.

Thanks! :)

EDIT: You will need import os, sorry to forget that detail.

CanineAnimal commented 1 year ago

I have indeed made the change to the saving code as to create a folder if it doesn't exist!

As to renaming the files instead of using "0.html" etc, that would require me to either rename each of the past files I have uploaded (which I can't be bothered to do), or also rewrite the client-side code for the web interface to work with both systems of naming. I would rather leave it as-is, really 😛

Thanks!

Clarissa-Valentine-Z commented 1 year ago

That's fair enough with renaming, no worries about that! Your method works great to me, and the simple number names are okay. <3 For me, that's my preference in case my files get mixed up one day.

Thanks for the wonderful tool, it's amazing, and to be honest, far better than me opening 500 pages that slows down the computer and threatens to take all my RAM. :P

Have a good one!

CanineAnimal commented 1 year ago

Closing the issue now.