add feed - ctolib

This commit is contained in:
alphardex
2019-01-17 19:55:19 +08:00
parent 59a70e6bd9
commit ba94100d35
4 changed files with 57 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ def ctx(category=''):
posts = tree.css('.feed_body .pagedlist_item')
return {
'title': '传送门',
'link': 'https://chuansongme.com',
'link': domain,
'description': '传送门:微信公众号订阅',
'author': 'alphardex',
'items': list(map(parse, posts))

View File

@@ -0,0 +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))
}