format weiyangx.express by flake8

This commit is contained in:
hillerliao
2020-04-12 12:52:34 +08:00
parent ebbae015bc
commit 6620af70bb
4 changed files with 53 additions and 1 deletions

View File

@@ -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',

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