Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #21

Merged
merged 4 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A Python tool for converting online stories into portable formats
* literotica.com
* classicreader.com
* chyoa.com (rudimentary support: Input the last page you wish to include, and the code will work backwards towards the beginning of the story. You will be asked to input customizable names if they are found)
* wattpad.com

## Currently supported file types:
* plain text files
Expand Down Expand Up @@ -37,9 +38,23 @@ To run Ebook-Publisher, use the terminal or command prompt to execute Python3 an
-f, --file Use text file containing a list of URLs instead of
single URL
-d DIRECTORY, --directory DIRECTORY
Directory to place output files. Default ./output/
Directory to place output files. Default ./

Ebook-Publisher can also take input from the standard input. If using standard input, any argument for url and the -f optional argument will be ignored. (Added only to master branch, not in any releases yet)


Sample Usage:
### Sample Usage:

`python3 Ebook-Publisher.py www.some.website/stories/my-story -o epub -d ~/Documents/My\ Books/`

`./Ebook-Publisher.py -f -o txt to-download.txt`

### Using standard input:

`cat list.txt | python3 Ebook-Publisher -d ./output`

`echo www.some.website/stories/my-story | ./Ebook-Publisher.py -o epub -d ~/Documents/My\ Books/`

### Advanced Usage:

Create a symbolic link to the binaries directory to where you have saved the main Ebook-Publisher.py file. i.e. `ln -s Ebook-Publisher.py /usr/bin/Ebook-Publisher` This will allow running Ebook-Publisher from any directory and can be used to avoid having to specify either the full path to Ebook-Publisher.py or the desired output directory given your current working directory is the desired output directory. Make sure Ebook-Publisher.py is executable first: `chmod +x Ebook-Publisher.py`
6 changes: 5 additions & 1 deletion Site/Chyoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import sys
from Site import Progress
#from subprocess import Popen, PIPE

class Chyoa:

Expand Down Expand Up @@ -47,6 +48,7 @@ def __init__(self, url):
for i in range(len(inputs)):
print('Input immersion variable '+str(i)+' '+soup.find('label', attrs={'for':'c'+str(i)}).get_text()+' ('+inputs[i].get('placeholder')+') (Leave blank to keep placeholder name)')
try:
sys.stdin = open('/dev/tty')
newname=input()
self.renames.append(newname)
except:
Expand Down Expand Up @@ -97,7 +99,7 @@ def __init__(self, url):
#TODO regular expressions go here

for i in range(len(self.temp)):
self.temp[i]='<h4>by '+self.authors[i]+'</h4>'+self.temp[i]
self.temp[i]='\n<h4>by '+self.authors[i]+'</h4>'+self.temp[i]
self.rawstoryhtml.append(BeautifulSoup(self.temp[i], 'html.parser'))
#print(self.rawstoryhtml[len(self.rawstoryhtml)-1].get_text())
self.author=self.authors[0]
Expand All @@ -118,6 +120,8 @@ def __init__(self, url):
for j in self.renames:
self.truestoryhttml[i]=self.truestoryhttml[i].replace('\n '+j+'\n', j)
self.truestoryhttml[i]=self.truestoryhttml[i].replace(' </span>\n ', '</span> ')

self.story=self.story.replace('\n', '\n\n')
#print(self.story)
#print(self.truestoryhttml[len(self.truestoryhttml)-1])
#for i in range(len(self.renames)):
Expand Down