Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 50094

Phoronix Updated Recipe

$
0
0
The old feed was from feedburner, added the direct one.


Code:

# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
__copyright__ = '2011 Aurélien Chabot <contact@aurelienchabot.fr>'

from calibre.web.feeds.news import BasicNewsRecipe


class Phoronix(BasicNewsRecipe):

    title = 'Phoronix'
    __author__ = 'calibre'
    description = 'Linux hardware reviews, performance benchmarks and open-source news'
    encoding = 'utf-8'
    publisher = 'Phoronix.com'
    category = 'news, IT, linux'
    language = 'en'

    use_embedded_content = False
    timefmt = ' [%d %b %Y]'
    max_articles_per_feed = 40
    no_stylesheets = True
    remove_empty_feeds = True
    filterDuplicates = True

    feeds = [('Phoronix', 'https://www.phoronix.com/rss.php')]

    keep_only_tags = [dict(name='article', attrs={'class': 'full'})]

    remove_tags = [
        dict(attrs={'id': lambda x: x and 'leaderboard' in x}),
        dict(attrs={'id': 'sharebar'}),
        dict(attrs={'id': 'about-author'}),
        dict(attrs={'class': 'foot'}),
        dict(attrs={'class': 'article-box'}),
        dict(attrs={'class': 'after-article'}),
        dict(attrs={'class': 'comments-label'}),
        dict(attrs={'class': 'pagination'}),
    ]

    extra_css = '''
        h1 { font-size: xx-large; font-family: Arial, Helvetica, sans-serif; }
        .author { font-size: small; color: #555; font-family: Arial, Helvetica, sans-serif; }
        .content { font-size: medium; font-family: Arial, Helvetica, sans-serif; }
    '''

    def get_browser(self):
        br = BasicNewsRecipe.get_browser(self)
        br.addheaders = [('User-Agent',
            'Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0')]
        return br

    def preprocess_html(self, soup):
        for item in soup.findAll(style=True):
            del item['style']
        return soup


Viewing all articles
Browse latest Browse all 50094

Latest Images

Trending Articles



Latest Images