Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-09-2012, 08:53 AM   #1
scissors
Addict
scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.
 
Posts: 206
Karma: 1001369
Join Date: Sep 2010
Device: prs300, kindle keyboard 3g
New Musical Express update 9/6/12

added cover
reviews and blogs via feed43 (feeds not working?)
Spoiler:
Code:
from calibre.web.feeds.news import BasicNewsRecipe
from calibre import browser
from calibre.utils.magick import Image
import re
class AdvancedUserRecipe1306061239(BasicNewsRecipe):
    title          = u'New Musical Express Magazine'
    description = 'Author D.Asbury. UK Rock & Pop Mag. '
    __author__ = 'Dave Asbury'
    # last updated 9/6/12
    remove_empty_feeds = True
    remove_javascript     = True
    no_stylesheets = True
    oldest_article = 7
    max_articles_per_feed = 20
    #auto_cleanup = True
    language = 'en_GB'

    def get_cover_url(self):
          soup = self.index_to_soup('http://www.magazinesdirect.com/categories/mens/tv-and-music/')
          cov = soup.find(attrs={'title' : 'NME magazine subscriptions'})
          cov2 = 'http://www.magazinesdirect.com'+cov['src']
          print '***cov =  ',cov2,' ***'
          
          cover_url = str(cov2)
         # print '**** Cov url =*', cover_url,'***'
          #print '**** Cov url =*','http://www.magazinesdirect.com/article_images/articledir_3138/1569221/1_largelisting.jpg','***'
          
          br = browser()
          br.set_handle_redirect(False)
          try:
               br.open_novisit(cov2)
               cover_url = str(cov2)
          except:
                    cover_url = 'http://tawanda3000.files.wordpress.com/2011/02/nme-logo.jpg'
          return cover_url
          masthead_url   = 'http://tawanda3000.files.wordpress.com/2011/02/nme-logo.jpg'

          
          remove_tags = [
	    dict( attrs={'class':'clear_icons'}),
	    dict( attrs={'class':'share_links'}),
                        dict( attrs={'id':'right_panel'}),
	    dict( attrs={'class':'today box'}),
	                          

                      ]	

    keep_only_tags = [

	dict(name='h1'),
	#dict(name='h3'),
	dict(attrs={'class' :  'BText'}),
	dict(attrs={'class' :  'Bmore'}),
	dict(attrs={'class' : 'bPosts'}),
	dict(attrs={'class' :  'text'}),
	dict(attrs={'id' :  'article_gallery'}),
                    #dict(attrs={'class' :  'image'}),
	dict(attrs={'class' :  'article_text'})

]


	         

    feeds          = [
	(u'NME News', u'http://feeds2.feedburner.com/nmecom/rss/newsxml'),
	#(u'Reviews', u'http://feeds2.feedburner.com/nme/SdML'),
	(u'Reviews',u'http://feed43.com/4138608576351646.xml'),
                    (u'Bloggs',u'http://feed43.com/3326754333186048.xml'),
	
	]
    extra_css = '''
                    h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
                    h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
                    p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
		'''

Last edited by scissors; 06-09-2012 at 02:13 PM. Reason: extra css for fonts added
scissors is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unutterably Silly Musical Change Word Association Nyssa Lounge 741 02-20-2012 12:20 AM
Musical book app for iOS darrenbolton Self-Promotions by Authors and Publishers 0 10-10-2011 07:20 AM
So What's Your Favorite Musical? kennyc Lounge 86 02-14-2011 12:09 PM
Joss Whedon's Internet Musical BenG Lounge 23 08-03-2008 08:59 PM
Musical Scores kenbaldwin Sony Reader 6 10-18-2006 12:09 PM


All times are GMT -4. The time now is 02:45 AM.


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