Quote:
Originally Posted by tbaac
Which recipe did you try the code with if you don't mind me asking?
|
I keep a test recipe and batch file all set up to paste code into when trying to give assistance. I just pasted your code into the end of whatever was already in that recipe. It happened to be SkepticBlog. I knew it worked before pasting in your code. Feel free to test it yourself.
Code:
#!/usr/bin/env python
__license__ = 'GPL v3'
import re
from calibre.web.feeds.news import BasicNewsRecipe
class SkepticBlog(BasicNewsRecipe):
oldest_article = 5
max_articles_per_feed = 15
no_stylesheets = True
use_embedded_content = False
encoding = 'utf-8'
publisher = 'Skeptic Magazine'
category = 'science, pseudoscience'
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
br.addheaders = [('Accept', 'text/html')]
return br
feeds = [(u'SkepticBlog', u'http://skepticblog.org/feed')]
def parse_feeds (self):
feeds = BasicNewsRecipe.parse_feeds(self)
for feed in feeds:
for article in feed.articles[:]:
print 'New1 article title is: ', article.title
feedps = feed.title + ' '
newtitle = feedps + article.title
article.title = newtitle
print 'New2 article title is: ', article.title
return feeds