add zaobao realtime

This commit is contained in:
hillerliao
2022-03-21 07:30:23 +08:00
parent 2d98a05937
commit 6b034dd3e2
4 changed files with 272 additions and 232 deletions

View File

@@ -15,7 +15,8 @@ def ctx(category=''):
url = f'{domain}/column/{category}'
DEFAULT_HEADERS.update({'Host': 'www.jintiankansha.me'})
tree = fetch(url, headers=DEFAULT_HEADERS)
posts = tree.css('.cell.item')
# posts = tree.css('.cell.item')
posts = tree.css('.item_title')
items = list(map(parse, posts))
column_title = tree.css('title::text').extract_first()

View File

@@ -0,0 +1,25 @@
from rsshub.utils import fetch
from rsshub.utils import DEFAULT_HEADERS
domain = 'https://www.zaobao.com'
def parse(post):
item = {}
item['description'] = item['title'] = post.css('div.f18.m-eps::text').extract_first()
item['link'] = domain + f"{post.css('a::attr(href)').extract_first()}"
return item
def ctx(category=''):
url = f"{domain}/realtime/{category}"
tree = fetch(url,headers=DEFAULT_HEADERS)
posts = tree.css('.col-lg-4.col-12.list-block.no-gutters')
print(posts)
return {
'title': f'{category} - 早报网即时新闻',
'link': url,
'description': f'{category} - 早报网即时新闻',
'author': 'hillerliao',
'items': list(map(parse, posts))
}