Quote:
Originally Posted by TonytheBookworm
Starson17,
Do you mind looking at this when you get a sec and telling me what the heck I'm doing wrong as far as the css is concerned please?
What my objective is, is to change this
Code:
Egypt’s housing market recovers!
it has the tag format of <div class="cdmainarticle">Egypt’s housing market recovers!</div>
So based on what I have gathered from other recipes and from you my code "should reformat it", but it doesn't.
|
1) It has class="cd_mainarticle", not class="cdmainarticle",
2) It has inline style on your header. Strip that first:
Code:
def preprocess_html(self, soup):
for item in soup.findAll(attrs={'style':True}):
del item['style']
return soup
Try this one:
Spoiler:
Code:
from calibre.web.feeds.news import BasicNewsRecipe
class GlobalProperty(BasicNewsRecipe):
title = 'Global Property Guide'
language = 'en'
__author__ = 'TonytheBookworm, with a little help from his friends'
description = 'This is a site for residential property investors who want to buy houses or apartments in other countries'
publisher = 'GlobalPropertyGuide.com'
category = 'prices,real-estate'
oldest_article = 10
max_articles_per_feed = 100
no_stylesheets = True
extra_css = '''
.cd_mainarticle{font-family:Arial,Helvetica,sans-serif; color:red; font-weight:bold;font-size:large;}
'''
keep_only_tags = [
dict(name='div', attrs={'class':['cd_mainbody']})
]
remove_tags = [
dict(name='div', attrs={'class':['addthis_toolbox addthis_default_style']}),
]
feeds = [
('Main Feed', 'http://www.globalpropertyguide.com/rss'),
]
def preprocess_html(self, soup):
for item in soup.findAll(attrs={'style':True}):
del item['style']
return soup
Edit: (I made the header red to spot the change easily.)