BQ Prime by unkn0wn

This commit is contained in:
Kovid Goyal 2022-07-10 20:20:03 +05:30
parent 709f5343a0
commit 68e82904fa
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

45
recipes/bq_prime.recipe Normal file
View File

@ -0,0 +1,45 @@
from calibre.web.feeds.news import BasicNewsRecipe, classes
class bq(BasicNewsRecipe):
title = u'BQ Prime'
description = 'Bloomberg Quint: Indias premier multi-platform business and financial news company.'
language = 'en_IN'
__author__ = 'unkn0wn'
oldest_article = 2 # days
max_articles_per_feed = 50
encoding = 'utf-8'
use_embedded_content = False
no_stylesheets = True
remove_attributes = ['style', 'height', 'width']
masthead_url = 'https://www.bqprime.com/icons/bqprime-blue.svg'
ignore_duplicate_articles = {'url'}
keep_only_tags = [
classes(
'story-base-template-m__story-content__1sSai print-story-card story-element-text'
),
dict(name='img', attrs={'property': 'og:image'})
]
remove_tags = [
classes(
'desktop-hidden desktop-only bm-container bookmark-m__bookmark-container__30eHl bookmark-m__container__23o1v'
),
dict(name='div', attrs={'id': 'piano-preview-story'})
]
feeds = [
('Articles', 'https://www.bqprime.com/stories.rss'),
]
def preprocess_raw_html(self, raw_html, url):
return raw_html.replace('<meta property="og:image" content=',
'<img property="og:image" src=')
def preprocess_html(self, soup):
pic = soup.find('img', attrs={'property': 'og:image'})
head = soup.find('h1')
if pic and head:
head.append(pic)
return soup