View Single Post
Old 10-16-2010, 01:23 PM   #1
PipSqueak
Junior Member
PipSqueak began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Oct 2010
Device: Kindle
So close yet so far... frustrated recipe

Can anyone help me fix this recipe? I'm trying to fetch news from a local newspaper. I think I'm *almost* there, but I suck with the regex because I don't know programming. Thanks

P.S. searched the forums and spent hours and hours doing the recipe before posting here as last resort

Code:
class AdvancedUserRecipe1287215970(BasicNewsRecipe):
    title          = u'The Star Malaysia'
    oldest_article = 2
    max_articles_per_feed = 1

    feeds          = [(u'Nation News', u'http://thestar.com.my/rss/nation.xml'), (u'Business News', u'http://thestar.com.my/rss/business.xml'), (u'Technology News', u'http://thestar.com.my/rss/technology.xml'), (u'World Updates', u'http://thestar.com.my/rss/worldupdates.xml'), (u'Sports News', u'http://thestar.com.my/rss/sports.xml'), (u'Columnists', u'http://thestar.com.my/rss/columnists.xml'), (u'Opinions', u'http://thestar.com.my/rss/opinion.xml')]

    from calibre.ptempfile import PersistentTemporaryFile
    temp_files = []
    articles_are_obfuscated = True

    def get_obfuscated_article(self, url):
        br = self.get_browser()
        br.open(url)

        response = br.follow_link(url_regex = r'/printerfriendly.asp?file=')
        html = response.read()

        self.temp_files.append(PersistentTemporaryFile('_fa.html'))
        self.temp_files[-1].write(html)
        self.temp_files[-1].close()

        return self.temp_files[-1].name
PipSqueak is offline   Reply With Quote