mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 15:09:23 +00:00
add weiyangx article in tag
This commit is contained in:
@@ -125,3 +125,8 @@ def techcrunch_tag(category=''):
|
||||
def weiyangx_express():
|
||||
from rsshub.spiders.weiyangx.express import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx()))
|
||||
|
||||
@bp.route('/weiyangx/tag/<string:category>')
|
||||
def weiyangx_tag(category=''):
|
||||
from rsshub.spiders.weiyangx.tag import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
33
rsshub/spiders/weiyangx/tag.py
Normal file
33
rsshub/spiders/weiyangx/tag.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import requests
|
||||
import json
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
domain = 'https://www.weiyangx.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post['title']
|
||||
item['description'] = post['content']
|
||||
item['link'] = post['url']
|
||||
item['author'] = post['authorMeta']
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
url = f'https://www.weiyangx.com/wp-admin/admin-ajax.php'
|
||||
q_data = {"action": "home_load_more_news",
|
||||
"postOffset": "00",
|
||||
"tagId": category,
|
||||
"_ajax_nonce": "1846edad4e"}
|
||||
|
||||
res = requests.post(url, data=q_data, headers=DEFAULT_HEADERS)
|
||||
posts = json.loads(res.text)['data']
|
||||
items = list(map(parse, posts))
|
||||
return {
|
||||
'title': f'快讯 - 未央网',
|
||||
'description': f'快讯 - 未央网',
|
||||
'link': f'{domain}/category/express',
|
||||
'author': f'hillerliao',
|
||||
'items': items
|
||||
}
|
||||
@@ -215,4 +215,17 @@
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
<!--item info start-->
|
||||
<div class="card text-left">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">未央网 tag文章列表</h4>
|
||||
<h6 class="text-muted">未央网 tag文章列表 <a href="https://github.com/hillerliao" target="_blank" class="badge badge-secondary">by hillerliao</a></h6>
|
||||
<p class="card-text">举例:<a href="https://rsshub-python.herokuapp.com/weiyangx/tag/270" target="_blank">https://rsshub-python.herokuapp.com/weiyangx/tag/270</a></p>
|
||||
<p class="card-text">路由:<code>/weiyangx/tag/:category</code></p>
|
||||
<p class="card-text">参数:category [必填,见 weiyangx 官网]</p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user