mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 15:09:23 +00:00
add chaindd column
This commit is contained in:
@@ -109,4 +109,9 @@ def xuangubao_xuangubao(type='', category=''):
|
||||
@bp.route('/cls/subject/<string:category>')
|
||||
def cls_subject(category=''):
|
||||
from rsshub.spiders.cls.subject import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
|
||||
@bp.route('/chaindd/column/<string:category>')
|
||||
def chaindd_column(category=''):
|
||||
from rsshub.spiders.chaindd.column import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
24
rsshub/spiders/chaindd/column.py
Normal file
24
rsshub/spiders/chaindd/column.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from rsshub.utils import fetch
|
||||
|
||||
domain = 'https://www.chaindd.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post.css('a::text').extract_first()
|
||||
item['description'] = post.css('p::text').extract_first()
|
||||
item['link'] = f"{domain}{post.css('a::attr(href)').extract_first()}"
|
||||
item['author'] = post.css('a.name::text').extract_first()
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
tree = fetch(f"{domain}/column/{category}")
|
||||
posts = tree.css('li .cont')
|
||||
return {
|
||||
'title': f'链得得栏目{category}最新文章',
|
||||
'link': f'{domain}/column/{category}',
|
||||
'description': f'链得得栏目{category}最新文章',
|
||||
'author': 'hillerliao',
|
||||
'items': list(map(parse, posts))
|
||||
}
|
||||
@@ -176,4 +176,17 @@
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
<!--item info start-->
|
||||
<div class="card text-left">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">链得得栏目动态</h4>
|
||||
<h6 class="text-muted">链得得栏目动态 <a href="https://github.com/hillerliao" target="_blank" class="badge badge-secondary">by hillerliao</a></h6>
|
||||
<p class="card-text">举例:<a href="https://rsshub-python.herokuapp.com/chaindd/column/3158465" target="_blank">https://rsshub-python.herokuapp.com/chaindd/column/3158465</a></p>
|
||||
<p class="card-text">路由:<code>/chaindd/column/:category</code></p>
|
||||
<p class="card-text">参数:category [必填,见链得得栏目url中的数字编号]</p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user