From b105b4cdbcd76ed44b4eefab688a8c6ca39a5636 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 8 Dec 2009 07:44:10 -0700 Subject: [PATCH] Improved recipe for Slate --- resources/recipes/slate.recipe | 38 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/resources/recipes/slate.recipe b/resources/recipes/slate.recipe index 82fde1e627..07ed89d0f4 100644 --- a/resources/recipes/slate.recipe +++ b/resources/recipes/slate.recipe @@ -14,7 +14,7 @@ class PeriodicalNameHere(BasicNewsRecipe): # Method variables for customizing downloads title = 'Slate' description = 'A general-interest publication offering analysis and commentary about politics, news and culture.' - __author__ = 'GRiker' + __author__ = 'GRiker and Sujata Raman' max_articles_per_feed = 20 oldest_article = 7.0 recursions = 0 @@ -50,8 +50,7 @@ class PeriodicalNameHere(BasicNewsRecipe): # The second entry is for 'Big Money', which comes from a different site, uses different markup remove_tags = [dict(attrs={ 'id':['toolbox','recommend_tab','insider_ad_wrapper', - 'article_bottom_tools_cntr','fray_article_discussion', - 'fray_article_links','bottom_sponsored_links','author_bio', + 'article_bottom_tools_cntr','fray_article_discussion', 'fray_article_links','bottom_sponsored_links','author_bio', 'bizbox_links_bottom','ris_links_wrapper','BOXXLE']}), dict(attrs={ 'id':['content-top','service-links-bottom','hed']}) ] @@ -60,18 +59,20 @@ class PeriodicalNameHere(BasicNewsRecipe): excludedAuthorKeywords = [] excludedContentKeywords = ['http://twitter.com/Slate'] - extra_css = '.headline {text-align:left;}\n\ - .byline {font-family: monospace; \ - text-align: left;\ - margin-bottom: 0px;}\n\ - .dateline {text-align: left; \ - font-size: smaller;\ - height: 0pt;}\n\ - .imagewrapper {text-align: center;}\n\ - .source {text-align: left;}\n\ - .credit {text-align: right;\ - font-size: smaller;}\n\ - .article_body {text-align: left;}\n' + extra_css = ''' + .h1_subhead{font-family:Arial; font-size:small; } + h1{font-family:Verdana; font-size:large; } + .byline {font-family:Georgia; margin-bottom: 0px; color: #660033;} + .dateline {font-family:Arial; font-size: smaller; height: 0pt; color:#666666;} + .imagewrapper {font-family:Verdana;font-size:x-small; } + .source {font-family:Verdana; font-size:x-small;} + .credit {font-family:Verdana; font-size: smaller;} + #article_body {font-family:Verdana; } + #content {font-family:Arial; } + .caption{font-family:Verdana;font-style:italic; font-size:x-small;} + h3{font-family:Arial; color:#666666; font-size:small} + a{color:#0066CC;} + ''' # Local variables to extend class baseURL = 'http://slate.com' @@ -339,6 +340,9 @@ class PeriodicalNameHere(BasicNewsRecipe): # Change

to

headline = soup.find("h1") + tag = headline.find("span") + tag.name = 'div' + if headline is not None : h2tag = Tag(soup, "h2") h2tag['class'] = "headline" @@ -348,8 +352,8 @@ class PeriodicalNameHere(BasicNewsRecipe): result += substr if i < len(strs) -1 : result += '
' - h2tag.insert(0, result) - headline.replaceWith(h2tag) + #h2tag.insert(0, result) + #headline.replaceWith(h2tag) # Fix up the concatenated byline and dateline byline = soup.find(True,attrs={'class':'byline'})