add jintiankansha

This commit is contained in:
hillerliao
2020-04-14 08:05:31 +08:00
parent 58e93a9e21
commit b1a2a8b839
2 changed files with 33 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
from rsshub.utils import DEFAULT_HEADERS
from rsshub.utils import fetch
domain = 'http://www.jintiankansha.me'
def parse(post):
item = {}
item['description'] = item['title'] = post.css('a::text').extract_first()
item['link'] = post.css('a::attr(href)').extract_first()
return item
def ctx(category=''):
url = f'{domain}/column/{category}'
tree = fetch(url, headers=DEFAULT_HEADERS)
posts = tree.css('.cell.item')
items = list(map(parse, posts))
column_title = tree.css('title::text').extract_first()
return {
'title': f'{column_title}',
'description': f'{category}',
'link': url,
'author': f'hillerliao',
'items': items
}