mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-16 07:26:46 +00:00
add cninfo announcement
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
from rsshub.utils import fetch
|
||||
|
||||
domain = 'https://chuansongme.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post.css('a.question_link::text').extract()[-1].strip()
|
||||
link = f"{domain}{post.css('a.question_link::attr(href)').extract_first()}"
|
||||
item['link'] = link
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
tree = fetch(f"{domain}/{category}")
|
||||
posts = tree.css('.feed_body .pagedlist_item')
|
||||
return {
|
||||
'title': '传送门',
|
||||
'link': domain,
|
||||
'description': '传送门:微信公众号订阅',
|
||||
'author': 'alphardex',
|
||||
'items': list(map(parse, posts))
|
||||
from rsshub.utils import fetch
|
||||
|
||||
domain = 'https://chuansongme.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post.css('a.question_link::text').extract()[-1].strip()
|
||||
link = f"{domain}{post.css('a.question_link::attr(href)').extract_first()}"
|
||||
item['link'] = link
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
tree = fetch(f"{domain}/{category}")
|
||||
posts = tree.css('.feed_body .pagedlist_item')
|
||||
return {
|
||||
'title': '传送门',
|
||||
'link': domain,
|
||||
'description': '传送门:微信公众号订阅',
|
||||
'author': 'alphardex',
|
||||
'items': list(map(parse, posts))
|
||||
}
|
||||
49
rsshub/spiders/cninfo/announcement.py
Normal file
49
rsshub/spiders/cninfo/announcement.py
Normal file
@@ -0,0 +1,49 @@
|
||||
import requests
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
domain = 'http://www.cninfo.com.cn'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post['secName'] + '(' + post['secCode'] + ')' + ': ' + post['announcementTitle']
|
||||
item['description'] = item['title']
|
||||
item['link'] = 'http://static.cninfo.com.cn/' + post['adjunctUrl']
|
||||
item['pubDate'] = post['announcementTime']
|
||||
return item
|
||||
|
||||
|
||||
def ctx(stock_id='', category=''):
|
||||
stock_id = '' if stock_id == 'all' else stock_id
|
||||
stock_name = ''
|
||||
stock_list = requests.get('http://www.cninfo.com.cn/new/data/szse_stock.json', headers=DEFAULT_HEADERS).json()['stockList']
|
||||
for stock in stock_list:
|
||||
if stock['code'] == stock_id :
|
||||
stock_id = stock['orgId']
|
||||
stock_name = stock['zwjc']
|
||||
break
|
||||
|
||||
import datetime
|
||||
nowtime = datetime.datetime.now()
|
||||
deltaday=datetime.timedelta(days=1)
|
||||
start_date = datetime.datetime.strftime(nowtime- 5 * deltaday, '%Y-%m-%d')
|
||||
end_date = datetime.datetime.strftime(nowtime + 2 * deltaday, '%Y-%m-%d')
|
||||
seDate = start_date + '~' + end_date
|
||||
|
||||
searchkey = ''
|
||||
if '_' in category:
|
||||
searchkey = category.split('_')[-1]
|
||||
category = category.split('_')[0]
|
||||
|
||||
|
||||
DEFAULT_HEADERS.update({'Referer': domain})
|
||||
posts = requests.post(f'{domain}/new/hisAnnouncement/query', \
|
||||
data={'pageSize': '30','tabName':'fulltext', 'plate': '', 'category':f'category_{category}_szsh', \
|
||||
'secid': stock_id,'seDate':'', 'seDate': seDate, 'searchkey': searchkey }, headers=DEFAULT_HEADERS).json()['announcements']
|
||||
return {
|
||||
'title': f'{stock_name}-{category}-公告-巨潮资讯',
|
||||
'link': f'{domain}/new/commonUrl/pageOfSearch?url=disclosure/list/search&checkedCategory=category_{category}_szsh&searchkey={searchkey}',
|
||||
'description': f'{stock_name}关于{category}的公告-巨潮资讯',
|
||||
'author': 'hillerliao',
|
||||
'items': list(map(parse, posts))
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
from rsshub.utils import fetch
|
||||
|
||||
domain = 'https://www.ctolib.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post.css('a.title::text').extract_first()
|
||||
item['description'] = post.css('p.abstract::text').extract_first()
|
||||
item['link'] = f"{domain}{post.css('a.title::attr(href)').extract_first()}"
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
tree = fetch(f'{domain}/python/topics/{category}')
|
||||
posts = tree.css('ul.note-list li')
|
||||
return {
|
||||
'title': 'CTOLib码库',
|
||||
'link': domain,
|
||||
'description': 'Python开发社区',
|
||||
'author': 'alphardex',
|
||||
'items': list(map(parse, posts))
|
||||
from rsshub.utils import fetch
|
||||
|
||||
domain = 'https://www.ctolib.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post.css('a.title::text').extract_first()
|
||||
item['description'] = post.css('p.abstract::text').extract_first()
|
||||
item['link'] = f"{domain}{post.css('a.title::attr(href)').extract_first()}"
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
tree = fetch(f'{domain}/python/topics/{category}')
|
||||
posts = tree.css('ul.note-list li')
|
||||
return {
|
||||
'title': 'CTOLib码库',
|
||||
'link': domain,
|
||||
'description': 'Python开发社区',
|
||||
'author': 'alphardex',
|
||||
'items': list(map(parse, posts))
|
||||
}
|
||||
@@ -1,24 +1,24 @@
|
||||
import requests
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
domain = 'https://www.infoq.cn'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post['article_title']
|
||||
item['description'] = f"{post['article_summary']}<br><img referrerpolicy='no-referrer' src={post.get('article_cover')}>"
|
||||
item['link'] = f"{domain}/article/{post['uuid']}"
|
||||
return item
|
||||
|
||||
|
||||
def ctx():
|
||||
DEFAULT_HEADERS.update({'Referer': 'https://www.infoq.cn'}) # 必须设置Referer,不然会451错误
|
||||
posts = requests.post(f'{domain}/public/v1/my/recommond', data={'size': 20}, headers=DEFAULT_HEADERS).json()['data']
|
||||
return {
|
||||
'title': 'infoq',
|
||||
'link': domain,
|
||||
'description': 'InfoQ - 促进软件开发领域知识与创新的传播',
|
||||
'author': 'alphardex',
|
||||
'items': list(map(parse, posts))
|
||||
import requests
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
domain = 'https://www.infoq.cn'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post['article_title']
|
||||
item['description'] = f"{post['article_summary']}<br><img referrerpolicy='no-referrer' src={post.get('article_cover')}>"
|
||||
item['link'] = f"{domain}/article/{post['uuid']}"
|
||||
return item
|
||||
|
||||
|
||||
def ctx():
|
||||
DEFAULT_HEADERS.update({'Referer': 'https://www.infoq.cn'}) # 必须设置Referer,不然会451错误
|
||||
posts = requests.post(f'{domain}/public/v1/my/recommond', data={'size': 20}, headers=DEFAULT_HEADERS).json()['data']
|
||||
return {
|
||||
'title': 'infoq',
|
||||
'link': domain,
|
||||
'description': 'InfoQ - 促进软件开发领域知识与创新的传播',
|
||||
'author': 'alphardex',
|
||||
'items': list(map(parse, posts))
|
||||
}
|
||||
Reference in New Issue
Block a user