View Single Post
Old 09-11-2011, 11:17 AM   #1
Herchu
Junior Member
Herchu began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Nov 2010
Device: iPad
Patch to grab UK The Observer's cover

The built-in guardian.recipe for The Guardian from Monday to Saturday and The Observer on Sunday fails to pick up the cover for the last one.

Apologize in advance if this is no the right place to post it but here is a small diff that fix it.

Code:
--- builtin-recipes/guardian.recipe	2011-09-02 10:50:04.000000000 +0200
+++ /Users/hernan/Tools/guardian.recipe	2011-09-04 16:09:47.000000000 +0200
@@ -15,8 +15,10 @@
     title = u'The Guardian and The Observer'
     if date.today().weekday() == 6:
         base_url = "http://www.guardian.co.uk/theobserver"
+        cover_pic = 'Observer digital edition'
     else:
         base_url = "http://www.guardian.co.uk/theguardian"
+        cover_pic = 'Guardian digital edition'
 
     __author__ = 'Seabound and Sujata Raman'
     language = 'en_GB'
@@ -79,7 +81,7 @@
         # soup = self.index_to_soup("http://www.guardian.co.uk/theobserver")
         soup = self.index_to_soup(self.base_url)
         # find cover pic
-        img = soup.find( 'img',attrs ={'alt':'Guardian digital edition'})
+        img = soup.find( 'img',attrs ={'alt': self.cover_pic})
         if img is not None:
             self.cover_url = img['src']
         # end find cover pic
Herchu is offline   Reply With Quote