add bbwc.cn realtime

This commit is contained in:
hillerliao
2022-11-06 17:49:54 +08:00
parent 3db8da9e8c
commit 12eace88e7
4 changed files with 46 additions and 6 deletions

View 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))
}