From bac39367b55a615462a984657774e3b812f3c619 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 Jan 2011 10:20:25 -0700 Subject: [PATCH] Update Volksrant --- resources/recipes/volksrant.recipe | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/resources/recipes/volksrant.recipe b/resources/recipes/volksrant.recipe index 6f3ec4ce0d..386cb1e729 100644 --- a/resources/recipes/volksrant.recipe +++ b/resources/recipes/volksrant.recipe @@ -1,4 +1,3 @@ -#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import with_statement @@ -29,13 +28,16 @@ class AdvancedUserRecipe1249039563(BasicNewsRecipe): language = 'nl' extra_css = ''' - body{font-family:Arial,Helvetica,sans-serif; font-size:small;} + body{font-family:Arial,Helvetica,sans-serif;font-size:small;} h1{font-size:large;} ''' ''' Change Log: Date: 10/10/10 - Modified code to include obfuscated to get the print version Author: Tony Stegall + + Date: 01/01/11 - Modified for better results around December/January. + Author: Martin Tarenskeen ''' ####################################################################################################### temp_files = [] @@ -48,11 +50,17 @@ class AdvancedUserRecipe1249039563(BasicNewsRecipe): year = date.today().year try: - response = br.follow_link(url_regex='.*?(%d)(\\/)(article)(\\/)(print)(\\/)'%year, nr = 0) - html = response.read() + response = br.follow_link(url_regex='.*?(%d)(\\/)(article)(\\/)(print)(\\/)'%year, nr = 0) + html = response.read() except: - response = br.open(url) - html = response.read() + year = year-1 + try: + response = br.follow_link(url_regex='.*?(%d)(\\/)(article)(\\/)(print)(\\/)'%year, nr = 0) + html = response.read() + except: + response = br.open(url) + html = response.read() + self.temp_files.append(PersistentTemporaryFile('_fa.html')) self.temp_files[-1].write(html) @@ -76,10 +84,3 @@ class AdvancedUserRecipe1249039563(BasicNewsRecipe): (u'Cultuur', u'http://www.volkskrant.nl/rss/kunst.rss'), (u'Gezondheid & Wetenschap', u'http://www.volkskrant.nl/rss/wetenschap.rss'), (u'Internet & Media', u'http://www.volkskrant.nl/rss/media.rss') ] - - -''' -example for formating -''' -# original url: http://www.volkskrant.nl/vk/nl/2668/Buitenland/article/detail/1031493/2010/10/10/Noord-Korea-ziet-nieuwe-leider.dhtml -# print url : http://www.volkskrant.nl/vk/nl/2668/2010/article/print/detail/1031493/Noord-Korea-ziet-nieuwe-leider.dhtml