|
|
#1 |
|
Member
![]() Posts: 18
Karma: 10
Join Date: Aug 2022
Device: Kobo Sage
|
Fixed recipe for Naked Capitalism
Hi,
This recipe for Naked Capitalism should be working now. |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,186
Karma: 29626604
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
|
|
|
|
|
#3 |
|
Member
![]() Posts: 18
Karma: 10
Join Date: Aug 2022
Device: Kobo Sage
|
The above recipe has stopped working unfortunately. This recipe is working though
Code:
#!/usr/bin/env python
# vim:fileencoding=utf-8
from calibre.web.feeds.news import BasicNewsRecipe
class NakedCapitalism(BasicNewsRecipe):
title = 'Naked Capitalism'
oldest_article = 7
max_articles_per_feed = 100
auto_cleanup = True
extra_css = """
body { font-family: serif !important; color: black !important; }
p { display: block !important; margin-bottom: 1em !important; line-height: 1.4 !important; }
div, article, section {
width: auto !important;
height: auto !important;
overflow: visible !important;
display: block !important;
}
"""
def preprocess_html(self, soup):
for tag in soup.findAll(['script', 'style', 'iframe']):
tag.decompose()
for tag in soup.findAll(True):
if tag.has_attr('style'):
del tag['style']
if tag.has_attr('srcset'):
del tag['srcset']
return soup
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
br.set_handle_robots(False)
br.addheaders = [
('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36 Edg/145.0.0.0'),
('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'),
('Accept-Language', 'en-US,en;q=0.5'),
('Accept-Encoding', 'gzip, deflate, br'),
('Connection', 'keep-alive'),
]
return br
feeds = [
('Naked Capitalism', 'https://www.nakedcapitalism.com/feed'),
]
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mainichi (English) Fixed Recipe | FooBarMitzvah | Recipes | 1 | 02-22-2022 12:47 AM |
| I fixed the Friday Times recipe | ireadtheinternet | Recipes | 1 | 11-28-2014 05:33 PM |
| Newsweek Polska - fixed recipe | admroz | Recipes | 1 | 10-16-2013 02:14 PM |
| Fixed brand eins recipe | siebert | Recipes | 18 | 07-30-2013 06:56 AM |
| Fixed Sydney Morning Herald Recipe | zephram | Recipes | 0 | 09-29-2011 08:51 AM |