| 1 |
from calibre.web.feeds.news import BasicNewsRecipe, classes |
| 2 |
|
| 3 |
|
| 4 |
class bq(BasicNewsRecipe): |
| 5 |
title = 'BQ Prime' |
| 6 |
description = 'Bloomberg Quint: India’s premier multi-platform business and financial news company.' |
| 7 |
language = 'en_IN' |
| 8 |
__author__ = 'unkn0wn' |
| 9 |
oldest_article = 2 # days |
| 10 |
max_articles_per_feed = 50 |
| 11 |
encoding = 'utf-8' |
| 12 |
use_embedded_content = False |
| 13 |
no_stylesheets = True |
| 14 |
remove_attributes = ['style', 'height', 'width'] |
| 15 |
masthead_url = 'https://www.bqprime.com/icons/bqprime-blue.svg' |
| 16 |
ignore_duplicate_articles = {'url'} |
| 17 |
|
| 18 |
keep_only_tags = [ |
| 19 |
classes('story-base-template-m__story-content__1sSai print-story-card story-element-text'), |
| 20 |
dict(name='img', attrs={'property': 'og:image'}), |
| 21 |
] |
| 22 |
|
| 23 |
remove_tags = [ |
| 24 |
classes('desktop-hidden desktop-only bm-container bookmark-m__bookmark-container__30eHl bookmark-m__container__23o1v'), |
| 25 |
dict(name='div', attrs={'id': 'piano-preview-story'}), |
| 26 |
] |
| 27 |
|
| 28 |
feeds = [ |
| 29 |
('Articles', 'https://www.bqprime.com/stories.rss'), |
| 30 |
] |
| 31 |
|
| 32 |
def preprocess_raw_html(self, raw_html, url): |
| 33 |
return raw_html.replace('<meta property="og:image" content=', '<img property="og:image" src=') |
| 34 |
|
| 35 |
def preprocess_html(self, soup): |
| 36 |
pic = soup.find('img', attrs={'property': 'og:image'}) |
| 37 |
head = soup.find('h1') |
| 38 |
if pic and head: |
| 39 |
head.append(pic) |
| 40 |
return soup |