View Single Post
Old 10-09-2011, 08:11 AM   #1
davide125
Member
davide125 began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Mar 2011
Device: Amazon Kindle 3G
better cover for Economist recipe

Hi,

here's a quick patch to get the Economist recipe to download full-size covers, instead of the (mostly unreadable) thumb it's using now:

Code:
--- economist.recipe	2011-09-30 10:03:50.000000000 +0200
+++ economist_fullcover.recipe	2011-10-09 14:05:23.550807015 +0200
@@ -22,8 +22,6 @@
             ' perspective. Best downloaded on Friday mornings (GMT)')
     extra_css      = '.headline {font-size: x-large;} \n h2 { font-size: small;  } \n h1 { font-size: medium;  }'
     oldest_article = 7.0
-    cover_url = 'http://media.economist.com/sites/default/files/imagecache/print-cover-thumbnail/print-covers/currentcoverus_large.jpg'
-    #cover_url = 'http://www.economist.com/images/covers/currentcoverus_large.jpg'
     remove_tags = [
             dict(name=['script', 'noscript', 'title', 'iframe', 'cf_floatingcontent']),
             dict(attrs={'class':['dblClkTrk', 'ec-article-info',
@@ -56,6 +54,14 @@
         return br
     '''
 
+    def get_cover_url(self):
+        br = BasicNewsRecipe.get_browser()
+        br.open(self.INDEX)
+        issue = br.geturl().split('/')[4]
+        self.log('Fetching issue: %s'%issue)
+        cover_url = "http://media.economist.com/sites/default/files/imagecache/print-cover-full/print-covers/%s_CNA400.jpg" %(issue.translate(None,'-'))
+        return cover_url
+
     def parse_index(self):
         return self.economist_parse_index()
Updated recipe is also attached.

Davide
Attached Files
File Type: zip economist_fullcover.zip (2.2 KB, 311 views)
davide125 is offline   Reply With Quote