mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-19 07:26:50 +00:00
add zaobao realtime
This commit is contained in:
@@ -180,6 +180,11 @@ def chouti_user(category=''):
|
|||||||
from rsshub.spiders.chouti.user import ctx
|
from rsshub.spiders.chouti.user import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
|
@bp.route('/zaobao/realtime/<string:category>')
|
||||||
|
def zaobao_realtime(category=''):
|
||||||
|
from rsshub.spiders.zaobao.realtime import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
@bp.route('/mp/tag/<string:mp>/<string:tag>')
|
@bp.route('/mp/tag/<string:mp>/<string:tag>')
|
||||||
def mp_tag(mp='', tag=''):
|
def mp_tag(mp='', tag=''):
|
||||||
from rsshub.spiders.mp.tag import ctx
|
from rsshub.spiders.mp.tag import ctx
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ def ctx(category=''):
|
|||||||
url = f'{domain}/column/{category}'
|
url = f'{domain}/column/{category}'
|
||||||
DEFAULT_HEADERS.update({'Host': 'www.jintiankansha.me'})
|
DEFAULT_HEADERS.update({'Host': 'www.jintiankansha.me'})
|
||||||
tree = fetch(url, headers=DEFAULT_HEADERS)
|
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))
|
items = list(map(parse, posts))
|
||||||
|
|
||||||
column_title = tree.css('title::text').extract_first()
|
column_title = tree.css('title::text').extract_first()
|
||||||
|
|||||||
25
rsshub/spiders/zaobao/realtime.py
Normal file
25
rsshub/spiders/zaobao/realtime.py
Normal 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))
|
||||||
|
}
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %} {% block title %}All Feeds{% endblock title %} {% block content %}
|
||||||
|
|
||||||
{% block title %}All Feeds{% endblock title %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="card text-left">
|
<div class="card text-left">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">传送门</h4>
|
<h4 class="card-title">传送门</h4>
|
||||||
@@ -206,6 +202,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">早报网 即时新闻文章列表</h4>
|
||||||
|
<h6 class="text-muted">早报网 即时新闻文章列表 <a href="https://github.com/hillerliao" target="_blank" class="badge badge-secondary">by hillerliao</a></h6>
|
||||||
|
<p class="card-text">举例:<a href="https://pyrsshub.herokuapp.com/zaobao/realtime/china" target="_blank">https://pyrsshub.herokuapp.com/zaobao/realtime/china</a></p>
|
||||||
|
<p class="card-text">路由:<code>/zaobao/realtime/:category</code></p>
|
||||||
|
<p class="card-text">参数:category [必填,见 早报网 官网]</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