mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-17 15:09:31 +00:00
add param support
This commit is contained in:
22
rsshub/spiders/chuansongme/articles.py
Normal file
22
rsshub/spiders/chuansongme/articles.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from rsshub.utils import fetch
|
||||
|
||||
domain = 'https://chuansongme.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post.css('a.question_link::text').extract()[-1].strip()
|
||||
item['link'] = f"{domain}{post.css('a.question_link::attr(href)').extract_first()}"
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
tree = fetch(f"{domain}/{category}")
|
||||
posts = tree.css('.feed_body .pagedlist_item')
|
||||
return {
|
||||
'title': '传送门',
|
||||
'link': 'https://chuansongme.com',
|
||||
'description': '传送门:微信公众号订阅',
|
||||
'author': 'alphardex',
|
||||
'items': list(map(parse, posts))
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import requests
|
||||
|
||||
data = requests.get(
|
||||
'https://www.guokr.com/apis/minisite/article.json?retrieve_type=by_subject'
|
||||
).json()['result']
|
||||
|
||||
|
||||
def parse(d):
|
||||
item = {}
|
||||
item['title'] = d['title']
|
||||
item['description'] = f"{d['summary']}<br><img referrerpolicy='no-referrer' src={d['image_info']['url']}"
|
||||
item['pubDate'] = d['date_published']
|
||||
item['link'] = d['url']
|
||||
return item
|
||||
|
||||
|
||||
ctx = {
|
||||
'title': '果壳网 科学人',
|
||||
'link': 'https://www.guokr.com/scientific',
|
||||
'description': '果壳网 科学人',
|
||||
'author': 'alphardex',
|
||||
'items': list(map(parse, data))
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
from rsshub.utils import fetch
|
||||
|
||||
base_url = 'https://toutiao.io'
|
||||
tree = fetch(base_url)
|
||||
items = []
|
||||
posts = tree.css('.posts .post')
|
||||
|
||||
for post in posts:
|
||||
item = {}
|
||||
item['title'] = post.css('.title a::attr(title)').extract_first()
|
||||
item['description'] = ''
|
||||
item['pubDate'] = ''
|
||||
item['link'] = base_url + post.css('.title a::attr(href)').extract_first()
|
||||
items.append(item)
|
||||
|
||||
ctx = {
|
||||
'title': '开发者头条:今日头条',
|
||||
'link': 'https://toutiao.io',
|
||||
'description': '开发者头条:今日头条',
|
||||
'author': 'alphardex',
|
||||
'items': items
|
||||
}
|
||||
Reference in New Issue
Block a user