Skip to content

Commit c583d37

Browse files
committed
Use title from the title-bar-title instead.
1 parent f614673 commit c583d37

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

script/packtpub.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,11 @@ def __parseDailyBookInfo(self, soup):
9898
def __parseNewsletterBookInfo(self, soup):
9999
div_target = soup.find('div', {'id': 'main-book'})
100100

101-
urlWithTitle = div_target.select('div.nano-book-main-image a')[0]['href']
102-
title = urlWithTitle.split('/')[-1].replace('-', ' ').title()
101+
title = soup.find('div', {'id': 'title-bar-title'}).h1.string.title()
103102
claimNode = div_target.select('div.nano-book-text a')
104103

105104
self.info['title'] = title
106-
self.info['filename'] = title.replace(' ', '_').encode('ascii', 'ignore')
105+
self.info['filename'] = title.replace(' ', '_').replace(':', '').encode('ascii', 'ignore')
107106
self.info['description'] = div_target.select('div.nano-book-text > div')[0].text.strip()
108107
self.info['url_image'] = 'https:' + div_target.select('div.nano-book-main-image img')[0]['src']
109108
self.info['url_claim'] = self.__url_base + claimNode[0]['href']

0 commit comments

Comments
 (0)