ga - Adds ability to easily override which issue will be downloaded

This commit is contained in:
Gary Arnold 2018-03-05 15:08:04 -08:00
parent 159d081456
commit dcab7f1569

View File

@ -10,6 +10,9 @@ import re
from calibre.web.feeds.news import BasicNewsRecipe
# Set this variable to the URL of the issue you want to download, if not the current issue
force_issue_download = None
##################################################################
# Adapted from https://gist.github.com/FlyingTopHat/7cfdd5434ec704916174
def plus_with_unknown_component(first_comp, second_comp, result):
@ -230,7 +233,7 @@ class Granta(BasicNewsRecipe):
return soup
def parse_index(self):
self.log.info('Making soup out of index')
if force_issue_download is None:
soup = self.index_to_soup('https://granta.com/')
# Get latest issue
@ -240,6 +243,10 @@ class Granta(BasicNewsRecipe):
issueAnchor = issueInfo.find('a')
issueTitle = issueAnchor.contents[0]
issueLink = issueAnchor.get('href')
else:
issueLink = force_issue_download
issueTitle = ''
soup = self.index_to_soup(issueLink)
# Find cover