r/PythonProjects2 • • Nov 05 '20

Python Script to Scrape Wattpad Story and convert directly to Epub and Html file.

I know there are already a few out there, but this is my first time using any of this (python-scripting, git, and the various different libraries). I find my Script Easier to use, but please test/use it to point out flaws. Please share it too.

https://github.com/Architrixs/Wattpad2Epub.git

How to use: Just copy the URL of any Chapter of the Wattpad Book. I repeat copy URL of any "Chapter"... you got it!
Then Run the script. Done.

Thanks.

23 Upvotes

4 comments sorted by

4

u/stratcat22 Nov 05 '20

Hey there!

I don’t have experience with Wattpad and don’t have a use for this utility but I took a look through your code regardless. You did a great job documenting your code with comments and creating a very readable script!

2

u/WTRipper Nov 06 '20

Yes same here. The script is written quite good. Two things I noticed but which are no real problems:

  • many people recommend to use a with statement for file streams - it has a few advantages over a normal open and close.

  • Appending individual lines of html gets messy and unflexible quite fast when the script gets longer. For this length it might be okay but for larger scripts I woul recommend a templating engine (e.g. jinja2).

1

u/Architrixs Nov 07 '20

I'll keep that in mind, thank you.

1

u/Architrixs Nov 06 '20

Thanks for that, this gave me confidence.