View Single Post
Old 06-06-2011, 05:09 PM   #5
tolgame
Junior Member
tolgame began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2011
Device: kindle 3
Sorry but I have given up, come back, given up again, come back again, a couple times now. I just can't figure out this GoComics code.
Could someone please help me out? The goal is to simply go to a bunch of RSS feed pages, fetch anything new (last x days), and show that content exactly as is, no formatting required. I have no experience with calibre, though.
I was trying to do it using Starson's advice about the virtual feed, here is my pitiful attempt. What am I doing wrong?


#!/usr/bin/env python

__license__ = 'GPL v3'
__copyright__ = 'Copyright 2010 Starson17'
'''
www.gocomics.com
'''
from calibre.web.feeds.news import BasicNewsRecipe
import mechanize, re

class GoJournal(BasicNewsRecipe):
title = 'Journals'
__author__ = 'Tolga'
__version__ = '1.05'
__date__ = '19 may 2011'
description = u'My journals.'
category = 'news, comics'
language = 'en'
use_embedded_content= False
no_stylesheets = True
remove_javascript = True
cover_url = 'http://paulbuckley14059.files.wordpress.com/2008/06/calvin-and-hobbes.jpg'
remove_attributes = ['style']


def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
cookies = mechanize.CookieJar()
br = mechanize.build_opener(mechanize.HTTPCookieProcess or(cookies))
br.addheaders = [('Referer','http://www.gocomics.com/')]
return br

def parse_index(self):
feeds = []
for title, url in [
# (u"9 to 5", u"http://feeds.feedburner.com/acs/achre4"),
# (u"9 to 5", u"http://feeds.feedburner.com/acs/aamick"),
]:
print 'Working on: ', title
articles = self.make_links(url)
if articles:
feeds.append((title, articles))
return feeds

def make_links(self, url):
title = 'Temp'
current_articles = [self.index_to_soup(url)]
return current_articles
tolgame is offline   Reply With Quote