mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-18 07:26:48 +00:00
add home list
This commit is contained in:
@@ -121,6 +121,11 @@ def techcrunch_tag(category=''):
|
|||||||
from rsshub.spiders.techcrunch.tag import ctx
|
from rsshub.spiders.techcrunch.tag import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
|
@bp.route('/weiyangx/home')
|
||||||
|
def weiyangx_home():
|
||||||
|
from rsshub.spiders.weiyangx.home import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx()))
|
||||||
|
|
||||||
@bp.route('/weiyangx/express/')
|
@bp.route('/weiyangx/express/')
|
||||||
def weiyangx_express():
|
def weiyangx_express():
|
||||||
from rsshub.spiders.weiyangx.express import ctx
|
from rsshub.spiders.weiyangx.express import ctx
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
from parsel import Selector
|
||||||
from rsshub.utils import DEFAULT_HEADERS
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
|
||||||
domain = 'https://www.weiyangx.com'
|
domain = 'https://www.weiyangx.com'
|
||||||
@@ -18,14 +19,11 @@ def parse(post):
|
|||||||
|
|
||||||
|
|
||||||
def ctx():
|
def ctx():
|
||||||
url = f'https://www.weiyangx.com/wp-admin/admin-ajax.php'
|
url = f'https://www.weiyangx.com/category/express'
|
||||||
q_data = {"action": "load_more_express",
|
res = requests.get(url, headers=DEFAULT_HEADERS)
|
||||||
"offset": "00",
|
res = Selector(res.text)
|
||||||
"category": "29817",
|
posts = res.css('script::text')[-4].extract().split('=')[-1]
|
||||||
"_ajax_nonce": "235111d38c"}
|
posts = json.loads(posts)
|
||||||
|
|
||||||
res = requests.post(url, data=q_data, headers=DEFAULT_HEADERS)
|
|
||||||
posts = json.loads(res.text)['expressList']
|
|
||||||
items = list(map(parse, posts))
|
items = list(map(parse, posts))
|
||||||
return {
|
return {
|
||||||
'title': f'快讯 - 未央网',
|
'title': f'快讯 - 未央网',
|
||||||
|
|||||||
31
rsshub/spiders/weiyangx/home.py
Normal file
31
rsshub/spiders/weiyangx/home.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
|
from parsel import Selector
|
||||||
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
|
||||||
|
domain = 'https://www.weiyangx.com'
|
||||||
|
|
||||||
|
|
||||||
|
def parse(post):
|
||||||
|
item = {}
|
||||||
|
item['title'] = post['title']
|
||||||
|
item['description'] = post['content']
|
||||||
|
post_id = post['id']
|
||||||
|
item['link'] = f'{domain}/{post_id}.html'
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
def ctx():
|
||||||
|
url = f'https://www.weiyangx.com/'
|
||||||
|
res = requests.get(url, headers=DEFAULT_HEADERS)
|
||||||
|
res = Selector(res.text)
|
||||||
|
posts = res.css('script::text')[-5].extract().split('=')[-1]
|
||||||
|
posts = json.loads(posts)
|
||||||
|
items = list(map(parse, posts))
|
||||||
|
return {
|
||||||
|
'title': f'快讯 - 未央网',
|
||||||
|
'description': f'快讯 - 未央网',
|
||||||
|
'link': f'{domain}/category/express',
|
||||||
|
'author': f'hillerliao',
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
@@ -1,28 +1,21 @@
|
|||||||
import requests
|
|
||||||
import json
|
|
||||||
from rsshub.utils import DEFAULT_HEADERS
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
from rsshub.utils import fetch
|
||||||
|
|
||||||
domain = 'https://www.weiyangx.com'
|
domain = 'https://www.weiyangx.com'
|
||||||
|
|
||||||
|
|
||||||
def parse(post):
|
def parse(post):
|
||||||
item = {}
|
item = {}
|
||||||
item['title'] = post['title']
|
item['title'] = post.css('h2::text').extract_first()
|
||||||
item['description'] = post['content']
|
item['description'] = post.css('p::text').extract_first()
|
||||||
item['link'] = post['url']
|
item['link'] = post.css('a::attr(href)').extract_first()
|
||||||
item['author'] = post['authorMeta']
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
def ctx(category=''):
|
def ctx(category=''):
|
||||||
url = f'https://www.weiyangx.com/wp-admin/admin-ajax.php'
|
url = f'https://www.weiyangx.com/tag/{category}'
|
||||||
q_data = {"action": "home_load_more_news",
|
tree = fetch(url, headers=DEFAULT_HEADERS)
|
||||||
"postOffset": "00",
|
posts = tree.css('.category-post-node')
|
||||||
"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))
|
items = list(map(parse, posts))
|
||||||
return {
|
return {
|
||||||
'title': f'{category} - 文章 - 未央网',
|
'title': f'{category} - 文章 - 未央网',
|
||||||
|
|||||||
Reference in New Issue
Block a user