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 01-04-2012, 10:52 PM   #1
thisisdeath
Junior Member
thisisdeath began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Dec 2011
Device: nook
Updated Alternet Recipe

This is a simple update of the Alternet recipe to linearize tables - this makes the recipe much more readable on the nook touch (previously text was running off the page)
Attached Files
File Type: zip Alternet_linearize table.zip (831 Bytes, 157 views)
thisisdeath is offline   Reply With Quote
Old 12-31-2012, 03:35 PM   #2
orcpac7
Junior Member
orcpac7 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jun 2010
Device: cailbre
Built-in recipe stopped working for me, several feeds discontinued. So I pared the recipe down till it worked.
I AM A CLUELESS NOOB!
With that disclaimer, here is a working recipe that gets the main articles and works for me with Calibre version 0.9.12.

from calibre.ptempfile import PersistentTemporaryFile
from calibre.web.feeds.news import BasicNewsRecipe

class Alternet(BasicNewsRecipe):
title = u'Alternet'
__author__= 'rty'
oldest_article = 7
max_articles_per_feed = 100
publisher = 'alternet.org'
category = 'News, Magazine'
description = 'News magazine and online community'
feeds = [
(u'Front Page', u'http://feeds.feedblitz.com/alternet')
]

remove_attributes = ['width', 'align','cellspacing']
remove_javascript = True
use_embedded_content = True
no_stylesheets = True
language = 'en'
encoding = 'UTF-8'
temp_files = []
articles_are_obfuscated = True

def get_article_url(self, article):
return article.get('link', None)

def get_obfuscated_article(self, url):
br = self.get_browser()
br.open(url)
response = br.follow_link(url_regex = r'/printversion/[0-9]+', nr = 0)
html = response.read()
self.temp_files.append(PersistentTemporaryFile('_f a.html'))
self.temp_files[-1].write(html)
self.temp_files[-1].close()
return self.temp_files[-1].name

conversion_options = {'linearize_tables': True}
orcpac7 is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Instapaper - Updated recipe khromov Recipes 78 01-23-2015 01:09 AM
Updated Recipe: They Draw and Cook Starson17 Recipes 0 03-13-2011 10:59 AM
EPL Talk Recipe Updated rylsfan Recipes 0 03-01-2011 09:05 AM
Updated recipe for Le Monde? veezh Recipes 5 01-20-2011 09:06 PM
One new recipe and other one updated (In Spanish) desUBIKado Recipes 3 01-19-2011 03:58 AM


All times are GMT -4. The time now is 07:38 AM.


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