Git Product home page Git Product logo

wattpad2epub's Introduction

Wattpad2Epub

Python Script to Scrape Wattpad Story and convert to Epub and html file.

This program will create:

  1. A html file of the entire Wattpad Book AND (You can directly Use this one to read, Images are preserved in this format.)
  2. A Epub file of the entire Wattpad Book.(The Epub will have separate marked Chapters instead of all chapters as one whole. Images included.)

Libraries used :

  1. Pyperclip
  2. Requests
  3. BeautifulSoup4
  4. re
  5. Pypandoc
  6. argparse

Note: Pypandoc uses pandoc, so it needs an available installation of pandoc.

Installing pandoc via pypandoc

Installing via pypandoc is possible on Windows, Mac OS X or Linux (Intel-based, 64-bit):

# expects an installed pypandoc: pip install pypandoc
from pypandoc.pandoc_download import download_pandoc
# see the documentation how to customize the installation path
# but be aware that you then need to include it in the `PATH`
download_pandoc()

The default install location is included in the search path for pandoc, so you don't need to add it to the PATH.

HOW TO USE :1. Just copy the URL of any Story of the Wattpad Book. I repeat copy URL of any "Story"... you got it!

It should look something like this: https://www.wattpad.com/story/39479-paper-ghosts

  1. Either Directly Run

     Wattpad2epub.py
     or
     Wattpad2epub.py Story_url     #Pyperclip library not needed for this.
    

    Yes, it can take 1 Commandline Argument as the copied url of the Story.

  2. You got html and epub saved in the same location.

Image of Wattpad2Epub Image of Wattpad2epub Windows

I found my script easy to use, but feel free to point out mistakes. Open Issues if you find any.

wattpad2epub's People

Contributors

architrixs avatar diya8 avatar imgbotapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wattpad2epub's Issues

TypeError: can only concatenate str (not "NoneType") to str

Running python .\Wattpad2epub.py https://www.wattpad.com/story/315799543-forbidden-love-max-mayfield produces this traceback:

Traceback (most recent call last):
  File "C:\Users\Domen\Downloads\Wattpad2Epub-main\Wattpad2epub.py", line 69, in <module>
    file.write("<br><b>Tags:</b> "+tags+"<br><br>"+summary+"<br>")
TypeError: can only concatenate str (not "NoneType") to str

Windows 10, Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32

I tried to install all the dependencies listed with pip install <dependency name>, but I am not sure if everything got installed correctly.

Encountering error when converting to epub

hello i keep on encountering this when it was converting to epub file. The following below is what appears
File "C:\Users\Admin\Downloads\Wattpad2Epub\Wattpad2epub.py", line 105, in
output = pypandoc.convert_file(story_name+".html", 'epub3', outputfile=story_name+".epub", extra_args=['--epub-chapter-level=2', f'--epub-cover-image={cover_image}'])
File "C:\Users\Admin\AppData\Roaming\Python\Python39\site-packages\pypandoc_init_.py", line 150, in convert_file
return convert_input(source_file, format, 'path', to, extra_args=extra_args,
File "C:\Users\Admin\AppData\Roaming\Python\Python39\site-packages\pypandoc_init
.py", line 351, in _convert_input
raise RuntimeError(
RuntimeError: Pandoc died with exitcode "99" during conversion: File Name(had to change for privacy purpose).jpg not found in resource path

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.