This commit is contained in:
Kovid Goyal 2024-08-30 08:58:02 +05:30
parent 3f8cb20444
commit 1ebb8b6574
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
8 changed files with 10 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import json
from html5_parser import parse from html5_parser import parse
from lxml import etree from lxml import etree
from calibre.ebooks.BeautifulSoup import NavigableString, Tag, BeautifulSoup from calibre.ebooks.BeautifulSoup import BeautifulSoup, NavigableString, Tag
from calibre.scraper.simple import read_url from calibre.scraper.simple import read_url
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
@ -199,7 +199,7 @@ class econ_search(BasicNewsRecipe):
if article and content: if article and content:
self.log('**fetching archive content') self.log('**fetching archive content')
article.append(content) article.append(content)
div = soup.findAll(attrs={'style': lambda x: x and x.startswith( div = soup.findAll(attrs={'style': lambda x: x and x.startswith(
('color:rgb(13, 13, 13);', 'color: rgb(18, 18, 18);') ('color:rgb(13, 13, 13);', 'color: rgb(18, 18, 18);')
)}) )})
@ -236,7 +236,7 @@ class econ_search(BasicNewsRecipe):
'default': '2' 'default': '2'
} }
} }
def parse_index(self): def parse_index(self):
url = 'https://www.economist.com/search?q={query}&sort={sort}&page={page}' url = 'https://www.economist.com/search?q={query}&sort={sort}&page={page}'
search = self.recipe_specific_options.get('q') search = self.recipe_specific_options.get('q')

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import random import random
from calibre.scraper.simple import read_url from calibre.scraper.simple import read_url
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from calibre.web.feeds.news import BasicNewsRecipe, classes from calibre.web.feeds.news import BasicNewsRecipe, classes
def absurl(url): def absurl(url):
if url.startswith('/'): if url.startswith('/'):
url = 'https://www.science.org' + url url = 'https://www.science.org' + url

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from calibre.web.feeds.news import BasicNewsRecipe, classes from calibre.web.feeds.news import BasicNewsRecipe, classes
def absurl(url): def absurl(url):
if url.startswith('/'): if url.startswith('/'):
url = 'https://www.science.org' + url url = 'https://www.science.org' + url

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from calibre.web.feeds.news import BasicNewsRecipe, classes from calibre.web.feeds.news import BasicNewsRecipe, classes
def absurl(url): def absurl(url):
if url.startswith('/'): if url.startswith('/'):
url = 'https://www.science.org' + url url = 'https://www.science.org' + url

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from calibre.web.feeds.news import BasicNewsRecipe, classes from calibre.web.feeds.news import BasicNewsRecipe, classes
def absurl(url): def absurl(url):
if url.startswith('/'): if url.startswith('/'):
url = 'https://www.science.org' + url url = 'https://www.science.org' + url

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from calibre.web.feeds.news import BasicNewsRecipe, classes from calibre.web.feeds.news import BasicNewsRecipe, classes
def absurl(url): def absurl(url):
if url.startswith('/'): if url.startswith('/'):
url = 'https://www.science.org' + url url = 'https://www.science.org' + url

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from calibre.web.feeds.news import BasicNewsRecipe, classes from calibre.web.feeds.news import BasicNewsRecipe, classes
def absurl(url): def absurl(url):
if url.startswith('/'): if url.startswith('/'):
url = 'https://www.science.org' + url url = 'https://www.science.org' + url