View Single Post
Old 08-14-2014, 04:20 AM   #2
logophile777
Junior Member
logophile777 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Aug 2014
Device: none
Update

The print_version function actually works correctly, but the issue is with the BBC page itself; it treats Calibre as a mobile device and shows the above-mentioned video instructions even in the print version, although these instructions are not shown in "desktop" Firefox.

I had to use the remove_tags feature to get rid of the annoying instructions.

Here's the simple recipe for BBC Arabic Middle East. I hope it will be enhanced and added to the built-in recipes in Calibre:

Code:
from calibre.web.feeds.news import BasicNewsRecipe

class BBCArabic(BasicNewsRecipe):
    title          = u'BBC Arabic Middle East'
    oldest_article = 7
    max_articles_per_feed = 100
    extra_css = 'body { text-align: right;  direction:rtl; } '
    auto_cleanup = True
    remove_tags = [
    {'class':['emp-alt-handheld', 'emp-noflash', 'emp-flashlink', 'emp-alt-screen']}
    ]


    feeds          = [(u'BBC Arabic Middle East', u'http://www.bbc.co.uk/arabic/middleeast/index.xml')]

    def print_version(self, url):
        return url + '?print=1'
logophile777 is offline   Reply With Quote