mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 07:26:44 +00:00
format weiyangx.express by flake8
This commit is contained in:
@@ -120,3 +120,8 @@ def chaindd_column(category=''):
|
||||
def techcrunch_tag(category=''):
|
||||
from rsshub.spiders.techcrunch.tag import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
|
||||
@bp.route('/weiyangx/express/')
|
||||
def weiyangx_express():
|
||||
from rsshub.spiders.weiyangx.express import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx()))
|
||||
|
||||
@@ -17,7 +17,6 @@ def ctx(category=''):
|
||||
res = requests.get(url, headers=DEFAULT_HEADERS)
|
||||
res = json.loads(res.text)
|
||||
posts = res
|
||||
print(posts)
|
||||
items = list(map(parse, posts))
|
||||
return {
|
||||
'title': f'{category} - tag - Techcrunch',
|
||||
|
||||
36
rsshub/spiders/weiyangx/express.py
Normal file
36
rsshub/spiders/weiyangx/express.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import requests
|
||||
import json
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
domain = 'https://www.weiyangx.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post['post_title']
|
||||
item['description'] = post['post_content']
|
||||
post_id = post['post_id']
|
||||
item['link'] = f'{domain}/{post_id}.html'
|
||||
item['pubDate'] = post['post_date'][0] + '-' + \
|
||||
post['post_date'][1] + '-' + \
|
||||
post['post_date'][2]
|
||||
return item
|
||||
|
||||
|
||||
def ctx():
|
||||
url = f'https://www.weiyangx.com/wp-admin/admin-ajax.php'
|
||||
q_data = {"action": "load_more_express",
|
||||
"offset": "00",
|
||||
"category": "29817",
|
||||
"_ajax_nonce": "235111d38c"}
|
||||
|
||||
res = requests.post(url, data=q_data, headers=DEFAULT_HEADERS)
|
||||
posts = json.loads(res.text)['expressList']
|
||||
items = list(map(parse, posts))
|
||||
return {
|
||||
'title': f'快讯 - 未央网',
|
||||
'description': f'快讯 - 未央网',
|
||||
'link': f'{domain}/category/express',
|
||||
'author': f'hillerliao',
|
||||
'items': items
|
||||
}
|
||||
@@ -203,4 +203,16 @@
|
||||
<br>
|
||||
<!--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://rsshub-python.herokuapp.com/weiyangx/express/" target="_blank">https://rsshub-python.herokuapp.com/weiyangx/express/</a></p>
|
||||
<p class="card-text">路由:<code>/weiyangx/express/</code></p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user