From ab72fba13bb94deceaa0aba0f2b54b2d80928f46 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 7 Nov 2009 08:42:47 -0700 Subject: [PATCH] IGN:Split new guardian recipe into sections --- resources/images/news/guardian.png | Bin 0 -> 548 bytes resources/recipes/guardian.recipe | 155 +++++++++++++++-------------- 2 files changed, 79 insertions(+), 76 deletions(-) create mode 100644 resources/images/news/guardian.png diff --git a/resources/images/news/guardian.png b/resources/images/news/guardian.png new file mode 100644 index 0000000000000000000000000000000000000000..64425a3b5574f662bd2058dd0ff2de2f09a98f75 GIT binary patch literal 548 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87#Mv$T^vI!PA?5s^grw%QLAj~o7L5HYFSs; z#5p;soE=sx93EP2ln>xJXw*6@LiS*wOvl6!vE!=FXQrN7`_9L+P{AWV_q~FOO?mnK zz3*$k-{XA{U-w8pAZ7NweVj>>3=Cmc7yOiRJ?XF}R^T+l*>Df>Ru6$4W@*XtyO#aC z_4SY1Q&gQU=&Ropy1iUjMD=ydyY-fi4{pqD{?XYKYC0)Lvt<6Abfw0fi@l$2 z`rdzTSNw6#Uzh%I`Ax7XU&_|U8yhSrH>p?Zq(^fZ-y&i0@bq~#Q&t_z_@yCGAYJO~ z`ru6=`-|JN#JASIZx(KGZ)so7pCqX;t#MI`hd66QXgABf3wO@Ezr_&~?R9LG6ubEL z1wU8)?s&O6CJE@mB(ra>;*Tsv=-TrY7 zSL?-%%t 0: - if {'title':title,'date':date,'url':url2,'description':desc} in articles: - ulrl2 = '' - #eliminate duplicates - else: - - desc = 'Main Section' - date = '' - articles.append({ + #eliminate duplicates start + if {'title':title,'date':date,'url':url2,'description':desc} in articles : + url2 = '' + #eliminate duplicates end + else: + if 'http://jobs.guardian.co.uk/' in url2: + url2 = '' + else: + + articles.append({ 'title':title, 'date':date, 'url':url2, - 'description':desc, - }) - #find the articles in the Main Section - else: - url ='' - - - - - return [('Current Issue', articles)] - + 'description':desc, + }) + #find the articles in the Main Section end + ans.append( articles) + + else: + url ='' + + + titles = map(self.find_title, sections) + ans1 = list(zip(titles,ans)) + + return ans1[2:] + + def find_title(self, section): + d = {'topstories':'Top Stories', 'international':'International', 'editorialsandreply':'Editorials and Reply', + 'commentanddebate':'Comment and Debate','uknews':'UK News','saturday':'Saturday','sunday':'Sunday', + 'reviews':'Reviews', 'obituaries':'Obituaries'} + + return d.get(section, section) def preprocess_html(self, soup): - + for item in soup.findAll(style=True): del item['style']