mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Pajamas Media
This commit is contained in:
parent
4892defbec
commit
8b7eda245e
@ -1,27 +1,27 @@
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
|
||||||
|
|
||||||
class PajamasMedia(BasicNewsRecipe):
|
class PajamasMedia(BasicNewsRecipe):
|
||||||
title = u'Pajamas Media'
|
title = u'Pajamas Media'
|
||||||
description = u'Provides exclusive news and opinion for forty countries.'
|
description = u'Provides exclusive news and opinion for forty countries.'
|
||||||
language = 'en'
|
language = 'en'
|
||||||
__author__ = 'Krittika Goyal'
|
__author__ = 'Krittika Goyal'
|
||||||
oldest_article = 1 #days
|
oldest_article = 2 #days
|
||||||
max_articles_per_feed = 25
|
max_articles_per_feed = 25
|
||||||
recursions = 1
|
recursions = 1
|
||||||
match_regexps = [r'http://pajamasmedia.com/blog/.*/2/$']
|
match_regexps = [r'http://pajamasmedia.com/blog/.*/2/$']
|
||||||
#encoding = 'latin1'
|
#encoding = 'latin1'
|
||||||
|
|
||||||
remove_stylesheets = True
|
remove_stylesheets = True
|
||||||
#remove_tags_before = dict(name='h1', attrs={'class':'heading'})
|
auto_cleanup = True
|
||||||
remove_tags_after = dict(name='div', attrs={'class':'paged-nav'})
|
##remove_tags_before = dict(name='h1', attrs={'class':'heading'})
|
||||||
remove_tags = [
|
#remove_tags_after = dict(name='div', attrs={'class':'paged-nav'})
|
||||||
dict(name='iframe'),
|
#remove_tags = [
|
||||||
dict(name='div', attrs={'class':['pages']}),
|
#dict(name='iframe'),
|
||||||
#dict(name='div', attrs={'id':['bookmark']}),
|
#dict(name='div', attrs={'class':['pages']}),
|
||||||
#dict(name='span', attrs={'class':['related_link', 'slideshowcontrols']}),
|
##dict(name='div', attrs={'id':['bookmark']}),
|
||||||
#dict(name='ul', attrs={'class':'articleTools'}),
|
##dict(name='span', attrs={'class':['related_link', 'slideshowcontrols']}),
|
||||||
]
|
##dict(name='ul', attrs={'class':'articleTools'}),
|
||||||
|
#]
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
('pajamas Media',
|
('pajamas Media',
|
||||||
@ -29,20 +29,20 @@ class PajamasMedia(BasicNewsRecipe):
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
#def preprocess_html(self, soup):
|
||||||
story = soup.find(name='div', attrs={'id':'innerpage-content'})
|
#story = soup.find(name='div', attrs={'id':'innerpage-content'})
|
||||||
#td = heading.findParent(name='td')
|
##td = heading.findParent(name='td')
|
||||||
#td.extract()
|
##td.extract()
|
||||||
|
|
||||||
soup = BeautifulSoup('<html><head><title>t</title></head><body></body></html>')
|
#soup = BeautifulSoup('<html><head><title>t</title></head><body></body></html>')
|
||||||
body = soup.find(name='body')
|
#body = soup.find(name='body')
|
||||||
body.insert(0, story)
|
#body.insert(0, story)
|
||||||
return soup
|
#return soup
|
||||||
|
|
||||||
def postprocess_html(self, soup, first):
|
#def postprocess_html(self, soup, first):
|
||||||
if not first:
|
#if not first:
|
||||||
h = soup.find(attrs={'class':'innerpage-header'})
|
#h = soup.find(attrs={'class':'innerpage-header'})
|
||||||
if h: h.extract()
|
#if h: h.extract()
|
||||||
auth = soup.find(attrs={'class':'author'})
|
#auth = soup.find(attrs={'class':'author'})
|
||||||
if auth: auth.extract()
|
#if auth: auth.extract()
|
||||||
return soup
|
#return soup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user