Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
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
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free (K/N/S/iBooks) RV Cooking Cookbook (Gooseberry Patch Classics) arcadata Deals and Resources (No Self-Promotion or Affiliate Links) 1 05-18-2012 06:05 PM
Patch: Use real ASIN instead of UUID in mobi files to show correct cover in KindleApp siebert Calibre 4 02-24-2012 08:13 AM
grab the big-ones (img) schuster Recipes 8 05-19-2011 02:09 PM
Grab news error with PDF output chatainsim Calibre 3 02-28-2010 06:59 PM
How to grab plain (Sciencedirect) HTML? johndoesecond Workshop 7 02-02-2010 04:17 PM


All times are GMT -4. The time now is 07:19 PM.


MobileRead.com is a privately owned, operated and funded community.