Skip to content

Commit

Permalink
Version 0.7.3
Browse files Browse the repository at this point in the history
-Fixed minor bug with headers
-Improved imports
-Fixed m.wuxiaworld.co html formatting
  • Loading branch information
dr_nyt committed Jun 9, 2019
1 parent fca5e59 commit 1b88b72
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 10 deletions.
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from tkinter import StringVar
from tkinter import OptionMenu
from tkinter import ttk
from tkinter import HORIZONTAL
import threading
import requests
import cfscrape
Expand All @@ -28,7 +29,7 @@
from ebooklib import epub
import string

version = "0.7.2" #Defines the current version
version = "0.7.3" #Defines the current version

class NovelPlanetScraper(object):

Expand Down Expand Up @@ -244,7 +245,7 @@ def compileNovel(self):
content += paras.prettify()

content += "<p> </p>"
content += "<p>Powered by dr_nyt</p>"
content += "<p>Support us by joining our discord: https://discord.gg/pktZVwV</p>"
content += "<p>If any errors occur, open an issue here: github.com/dr-nyt/Translated-Novel-Downloader/issues</p>"
content += "<p>You can download more novels using the app here: github.com/dr-nyt/Translated-Novel-Downloader</p>"

Expand Down Expand Up @@ -314,6 +315,7 @@ def compileNovel(self):

self.msg('+'*20)
self.msg(self.novelName + ' has compiled!')
self.msg("You can support this project by joining our discord: https://discord.gg/pktZVwV")
self.msg('+'*20)

class WuxiaScraper(object):
Expand Down Expand Up @@ -555,7 +557,8 @@ def getChapterLinks(self):
shutil.move(file, folder + '/' + file)

self.msg('+'*20)
self.msg('Volume: ' + str(self.volume) + ' compiled!')
self.msg('Volume: ' + str(self.volume) + ' compiled!')
self.msg("You can support this project by joining our discord: https://discord.gg/pktZVwV")
self.msg('+'*20)
break

Expand All @@ -568,6 +571,7 @@ def getChapterLinks(self):

self.msg('+'*20)
self.msg('Volume: ' + str(self.volume) + ' compiled!')
self.msg("You can support this project by joining our discord: https://discord.gg/pktZVwV")
self.msg('+'*20)

#This method loops through every chapter of a volume and compiles them properly, adding in headers and separator between each chapter.
Expand All @@ -590,7 +594,7 @@ def getChapter(self):
content += story_view.prettify().replace('\xa0', ' ').replace('Previous Chapter', '').replace('Next Chapter', '')

content += "<p> </p>"
content += "<p>Powered by dr_nyt</p>"
content += "<p>Support us by joining our discord: https://discord.gg/pktZVwV</p>"
content += "<p>If any errors occur, open an issue here: github.com/dr-nyt/Translated-Novel-Downloader/issues</p>"
content += "<p>You can download more novels using the app here: github.com/dr-nyt/Translated-Novel-Downloader</p>"

Expand Down Expand Up @@ -810,14 +814,21 @@ def buildChapterLinks(self):
url = requests.get(link)
soup = BeautifulSoup(url.text, 'html.parser')
story_text = self.get_page(soup)

chapter = "<h1>" + str(chapter_name) + "</h1><br/>"
story = f"<h1>{chapter_name}</h1><br/><p>" + str(story_text) + "</p><br/><br/><br/>"
content = f"<h2>{chapter_name}</h2>"

try:
chap = epub.EpubHtml(title=chapter_name, file_name=tempLink + '.xhtml', lang='en')
content = story
except:
chap = epub.EpubHtml(title=chapter_name, file_name=tempLink + '.xhtml', lang='en')
content = story

content += story_text.prettify()

content += "<p> </p>"
content += "<p>Support us by joining our discord: https://discord.gg/pktZVwV</p>"
content += "<p>If any errors occur, open an issue here: github.com/dr-nyt/Translated-Novel-Downloader/issues</p>"
content += "<p>You can download more novels using the app here: github.com/dr-nyt/Translated-Novel-Downloader</p>"

chap.content = u'%s' % content
chapterList.append(chap)
Expand Down Expand Up @@ -880,12 +891,12 @@ def buildChapterLinks(self):

self.msg('+' * 20)
self.msg('Novel: ' + str(self.novelName) + ' compiled!')
self.msg("You can support this project by joining our discord: https://discord.gg/pktZVwV")
self.msg('+' * 20)

def get_page(self, soup):
page = soup.find_all("div", id="chaptercontent")
text = str(page).split('</div>')[1]
return text
page = soup.find("div", id="chaptercontent")
return page



Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.

0 comments on commit 1b88b72

Please sign in to comment.