diff --git a/rsshub/blueprints/main.py b/rsshub/blueprints/main.py index 2424080..ebbf49e 100644 --- a/rsshub/blueprints/main.py +++ b/rsshub/blueprints/main.py @@ -200,6 +200,11 @@ def pgyer_app(category=''): from rsshub.spiders.pgyer.app import ctx return render_template('main/atom.xml', **filter_content(ctx(category))) +@bp.route('/economist/worldbrief') +def economist_wordlbrief(category=''): + from rsshub.spiders.economist.worldbrief import ctx + return render_template('main/atom.xml', **filter_content(ctx(category))) + @bp.route('/mp/gh/') def mp_gh(gh=''): from rsshub.spiders.mp.gh import ctx diff --git a/rsshub/spiders/economist/worldbrief.py b/rsshub/spiders/economist/worldbrief.py new file mode 100644 index 0000000..5e646cd --- /dev/null +++ b/rsshub/spiders/economist/worldbrief.py @@ -0,0 +1,27 @@ +import re +from rsshub.utils import DEFAULT_HEADERS +from rsshub.utils import fetch + +domain = 'https://www.economist.com' + +def parse(post): + item = {} + item['title'] = post.css('div.e18qdnq10').get() + item['title'] = re.sub(r'<[^>]*>', '', item['title']).strip() + item['description'] = item['title'] + link = f"{domain}/the-world-in-brief" + return item + +def ctx(category=''): + url = f"{domain}/the-world-in-brief" + tree = fetch(url,headers=DEFAULT_HEADERS) + posts = tree.css('._gobbet') + + return { + 'title': f'World Brief - Economist', + 'link': url, + 'description': f'The world in brief: Catch up quickly on the global stories that matter', + 'author': 'hillerliao', + 'items': list(map(parse, posts)) + } + diff --git a/rsshub/templates/main/feeds.html b/rsshub/templates/main/feeds.html index b460af5..d39f63d 100644 --- a/rsshub/templates/main/feeds.html +++ b/rsshub/templates/main/feeds.html @@ -30,6 +30,18 @@
+ +
+
+

The world in brief - The Economist

+
World Brief by hillerliao
+

举例:https://pyrsshub.vercel.app/economist/worldbrief

+

路由:/economist/worldbrief

+
+
+
+ +

传送门-失效