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

@@ -134,4 +134,9 @@ def weiyangx_express():
@bp.route('/weiyangx/tag/<string:category>')
def weiyangx_tag(category=''):
from rsshub.spiders.weiyangx.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('/jintiankansha/column/<string:category>')
def jintiankansha_column(category=''):
from rsshub.spiders.jintiankansha.column import ctx
return render_template('main/atom.xml', **filter_content(ctx(category)))

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
}