mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
ga - Adds ability to easily override which issue will be downloaded
This commit is contained in:
parent
159d081456
commit
dcab7f1569
@ -10,6 +10,9 @@ import re
|
|||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
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
|
# Adapted from https://gist.github.com/FlyingTopHat/7cfdd5434ec704916174
|
||||||
def plus_with_unknown_component(first_comp, second_comp, result):
|
def plus_with_unknown_component(first_comp, second_comp, result):
|
||||||
@ -230,16 +233,20 @@ class Granta(BasicNewsRecipe):
|
|||||||
return soup
|
return soup
|
||||||
|
|
||||||
def parse_index(self):
|
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/')
|
soup = self.index_to_soup('https://granta.com/')
|
||||||
|
|
||||||
# Get latest issue
|
# Get latest issue
|
||||||
issueInfo = soup.find(
|
issueInfo = soup.find(
|
||||||
'div', attrs={'class': 'dnd_container dnd_container__heading'})
|
'div', attrs={'class': 'dnd_container dnd_container__heading'})
|
||||||
|
|
||||||
|
issueAnchor = issueInfo.find('a')
|
||||||
|
issueTitle = issueAnchor.contents[0]
|
||||||
|
issueLink = issueAnchor.get('href')
|
||||||
|
else:
|
||||||
|
issueLink = force_issue_download
|
||||||
|
issueTitle = ''
|
||||||
|
|
||||||
issueAnchor = issueInfo.find('a')
|
|
||||||
issueTitle = issueAnchor.contents[0]
|
|
||||||
issueLink = issueAnchor.get('href')
|
|
||||||
soup = self.index_to_soup(issueLink)
|
soup = self.index_to_soup(issueLink)
|
||||||
|
|
||||||
# Find cover
|
# Find cover
|
||||||
|
Loading…
x
Reference in New Issue
Block a user