#!/usr/bin/env python # vim:fileencoding=utf-8 """ scmp.com """ import json import re from datetime import datetime, timedelta, timezone from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.web.feeds.news import BasicNewsRecipe, classes class SCMP(BasicNewsRecipe): title = "South China Morning Post" __author__ = "llam" description = "SCMP.com, Hong Kong's premier online English daily provides exclusive up-to-date news, audio video news, podcasts, RSS Feeds, Blogs, breaking news, top stories, award winning news and analysis on Hong Kong and China." # noqa publisher = "South China Morning Post Publishers Ltd." oldest_article = 1 max_articles_per_feed = 25 no_stylesheets = True remove_javascript = True encoding = "utf-8" use_embedded_content = False language = "en" remove_empty_feeds = True publication_type = "newspaper" auto_cleanup = False compress_news_images = True ignore_duplicate_articles = {"title", "url"} recipe_specific_options = { 'days': { 'short': 'Oldest article to download from this news source. In days ', 'long': 'For example, 0.5, gives you articles from the past 12 hours', 'default': str(oldest_article) } } def __init__(self, *args, **kwargs): BasicNewsRecipe.__init__(self, *args, **kwargs) d = self.recipe_specific_options.get('days') if d and isinstance(d, str): self.oldest_article = float(d) # used when unable to extract article from