mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #3964 (News scientist recipe not working)
This commit is contained in:
parent
ab72fba13b
commit
e0d81d8404
@ -12,8 +12,7 @@ class NewScientist(BasicNewsRecipe):
|
|||||||
title = 'New Scientist - Online News'
|
title = 'New Scientist - Online News'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'Science news and science articles from New Scientist.'
|
description = 'Science news and science articles from New Scientist.'
|
||||||
language = 'en'
|
language = 'en'
|
||||||
|
|
||||||
publisher = 'New Scientist'
|
publisher = 'New Scientist'
|
||||||
category = 'science news, science articles, science jobs, drugs, cancer, depression, computer software, sex'
|
category = 'science news, science articles, science jobs, drugs, cancer, depression, computer software, sex'
|
||||||
delay = 3
|
delay = 3
|
||||||
@ -21,16 +20,14 @@ class NewScientist(BasicNewsRecipe):
|
|||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
remove_javascript = True
|
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
|
|
||||||
html2lrf_options = [
|
conversion_options = {
|
||||||
'--comment', description
|
'comment' : description
|
||||||
, '--category', category
|
, 'tags' : category
|
||||||
, '--publisher', publisher
|
, 'publisher' : publisher
|
||||||
]
|
, 'language' : language
|
||||||
|
}
|
||||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'id':['pgtop','maincol']})]
|
keep_only_tags = [dict(name='div', attrs={'id':['pgtop','maincol']})]
|
||||||
|
|
||||||
@ -53,18 +50,9 @@ class NewScientist(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def get_article_url(self, article):
|
def get_article_url(self, article):
|
||||||
url = article.get('link', None)
|
url = article.get('guid', None)
|
||||||
raw = article.get('description', None)
|
|
||||||
rsoup = self.index_to_soup(raw)
|
|
||||||
atags = rsoup.findAll('a',href=True)
|
|
||||||
for atag in atags:
|
|
||||||
if atag['href'].startswith('http://res.feedsportal.com/viral/sendemail2.html?'):
|
|
||||||
st, sep, rest = atag['href'].partition('&link=')
|
|
||||||
real_url, sep2, drest = rest.partition('" target=')
|
|
||||||
return real_url
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
rawurl, sep, params = url.partition('?')
|
return url + '?full=true&print=true'
|
||||||
return rawurl + '?full=true&print=true'
|
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ from setup import __version__ as VERSION, __appname__ as APPNAME, SRC, Command,
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
except:
|
|
||||||
setup
|
setup
|
||||||
|
except:
|
||||||
class setup:
|
class setup:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user