mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-15 07:26:51 +00:00
add bbwc.cn realtime
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
title = "lightly settings"
|
|
||||||
|
|
||||||
ports = []
|
|
||||||
|
|
||||||
[languages]
|
|
||||||
@@ -56,6 +56,11 @@ def ctolib_topics(category=''):
|
|||||||
from rsshub.spiders.ctolib.topics import ctx
|
from rsshub.spiders.ctolib.topics import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
|
@bp.route('/bbwc/realtime/<string:category>')
|
||||||
|
def bbwc_realtime(category=''):
|
||||||
|
from rsshub.spiders.bbwc.realtime import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/infoq/recommend')
|
@bp.route('/infoq/recommend')
|
||||||
def infoq_recommend():
|
def infoq_recommend():
|
||||||
|
|||||||
28
rsshub/spiders/bbwc/realtime.py
Normal file
28
rsshub/spiders/bbwc/realtime.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import json
|
||||||
|
import requests
|
||||||
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
|
||||||
|
domain = 'https://api.bbwc.cn'
|
||||||
|
|
||||||
|
|
||||||
|
def parse(post):
|
||||||
|
item = {}
|
||||||
|
item['title'] = post['title']
|
||||||
|
item['description'] = post['content']
|
||||||
|
item['link'] = post['link']
|
||||||
|
item['pubDate'] = post['inputtime']
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
def ctx(category=''):
|
||||||
|
url = f'{domain}/web/Newsflash/articlelist/l/{category}/device/30/appid/1/p/1/ps/100'
|
||||||
|
posts = requests.get(url)
|
||||||
|
print(posts)
|
||||||
|
posts = json.loads(posts.text)['data']['list']
|
||||||
|
return {
|
||||||
|
'title': f'{category} - 即时新闻 - 商业周刊',
|
||||||
|
'link': f'{domain}/realtime/index.html',
|
||||||
|
'description': f'抓取彭博商业周刊即时新闻栏目的快讯',
|
||||||
|
'author': 'hillerliao',
|
||||||
|
'items': list(map(parse, posts))
|
||||||
|
}
|
||||||
@@ -42,6 +42,19 @@
|
|||||||
<br>
|
<br>
|
||||||
<!--item info end-->
|
<!--item info end-->
|
||||||
|
|
||||||
|
<!--item info start-->
|
||||||
|
<div class="card text-left">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4 class="card-title">Realtime - 彭博商业周刊</h4>
|
||||||
|
<h6 class="text-muted">Realtime <a href="https://github.com/hillerliao" target="_blank" class="badge badge-secondary">by hillerliao</a></h6>
|
||||||
|
<p class="card-text">举例:<a href="https://pyrsshub.vercel.app/bbwc/2" target="_blank">https://pyrsshub.vercel.app/bbwc/2</a></p>
|
||||||
|
<p class="card-text">路由:<code>/bbwc/:category</code></p>
|
||||||
|
<p class="card-text">参数:category,分类,1 - 中文、2 - 英文</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!--item info end-->
|
||||||
|
|
||||||
<!--item info start-->
|
<!--item info start-->
|
||||||
<div class="card text-left">
|
<div class="card text-left">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|||||||
Reference in New Issue
Block a user