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
@ -13,7 +13,6 @@ class NewScientist(BasicNewsRecipe):
|
||||
__author__ = 'Darko Miletic'
|
||||
description = 'Science news and science articles from New Scientist.'
|
||||
language = 'en'
|
||||
|
||||
publisher = 'New Scientist'
|
||||
category = 'science news, science articles, science jobs, drugs, cancer, depression, computer software, sex'
|
||||
delay = 3
|
||||
@ -21,16 +20,14 @@ class NewScientist(BasicNewsRecipe):
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
remove_javascript = True
|
||||
encoding = 'utf-8'
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment', description
|
||||
, '--category', category
|
||||
, '--publisher', publisher
|
||||
]
|
||||
|
||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
||||
conversion_options = {
|
||||
'comment' : description
|
||||
, 'tags' : category
|
||||
, 'publisher' : publisher
|
||||
, 'language' : language
|
||||
}
|
||||
|
||||
keep_only_tags = [dict(name='div', attrs={'id':['pgtop','maincol']})]
|
||||
|
||||
@ -53,18 +50,9 @@ class NewScientist(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
def get_article_url(self, article):
|
||||
url = article.get('link', 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
|
||||
url = article.get('guid', None)
|
||||
return url
|
||||
|
||||
def print_version(self, url):
|
||||
rawurl, sep, params = url.partition('?')
|
||||
return rawurl + '?full=true&print=true'
|
||||
return url + '?full=true&print=true'
|
||||
|
||||
|
@ -9,8 +9,8 @@ from setup import __version__ as VERSION, __appname__ as APPNAME, SRC, Command,
|
||||
|
||||
try:
|
||||
from setuptools import setup
|
||||
except:
|
||||
setup
|
||||
except:
|
||||
class setup:
|
||||
pass
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user