Skip to content

Commit

Permalink
Merge pull request lorenzodifuccia#15 from PoHsun-Su/master
Browse files Browse the repository at this point in the history
Fixed invalid filename
  • Loading branch information
ViciousPotato authored Nov 26, 2017
2 parents b672144 + dd4157e commit 419ee00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion safaribook/spiders/safaribooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def parse_page(self, title, bookid, path, response):
def parse_toc(self, response):
toc = eval(response.body)
self.book_name = toc['title_safe']
self.book_title = toc['title'].replace(' ','_').replace(':',' -') # to be used for filename
self.book_title = re.sub(r'["%*/:<>?\\|~\s]', r'_', toc['title']) # to be used for filename
cover_path, = re.match(r'<img src="(.*?)" alt.+', toc["thumbnail_tag"]).groups()
yield scrapy.Request(self.host + cover_path,
callback=partial(self.parse_cover_img, "cover-image"))
Expand Down

0 comments on commit 419ee00

Please sign in to comment.