add tadoku.org

This commit is contained in:
Hiller Liao
2023-07-09 20:46:09 +08:00
parent 73d5bdbc18
commit 5aaba55dbd
3 changed files with 45 additions and 9 deletions

View File

@@ -308,16 +308,14 @@ def nhk_newseasy(category='', keywords=''):
from rsshub.spiders.nhk.newseasy import ctx
return render_template('main/atom.xml', **filter_content(ctx(category)))
@bp.route('/tadoku/books/<string:category>')
@cache.cached(timeout=3600)
def tadoku_books(category=''):
from rsshub.spiders.tadoku.books import ctx
return render_template('main/atom.xml', **filter_content(ctx(category)))
@bp.route('/filter/')
def rss_filter():
from rsshub.spiders.rssfilter.filter import ctx
feed_url = request.args.get("feed")
return render_template('main/atom.xml', **filter_content(ctx(feed_url)))
'''
@bp.route('/test')
@bp.route('/test/测试')
def test():
import sys
# return sys.getdefaultencoding()
return sys.stdout.encoding
'''
return render_template('main/atom.xml', **filter_content(ctx(feed_url)))

View File

@@ -0,0 +1,25 @@
import re
from rsshub.utils import DEFAULT_HEADERS
from rsshub.utils import fetch
domain = 'https://tadoku.org'
def parse(post):
item = {}
item['title'] = post.css('.bl-title').css('a::text').extract_first()
item['description'] = post.css('.bl-thumb').extract_first() + post.css('.bl-title').extract_first()
item['link'] = post.css('.bl-title').css('a::attr(href)').extract_first()
return item
def ctx(category=''):
url = f"{domain}/japanese/book-search?level={category}"
tree = fetch(url,headers=DEFAULT_HEADERS)
posts = tree.css('.col-6.col-sm-4.col-md-3.col-lg-2.bl-wrap-small')
return {
'title': f'{category} Books - TADOKU.ORG',
'link': url,
'description': f'Book searching result - TADOKU.ORG',
'author': 'hillerliao',
'items': list(map(parse, posts))
}

View File

@@ -230,6 +230,19 @@
<br>
<!--item info end-->
<!--item info start-->
<div class="card text-left">
<div class="card-body">
<h4 class="card-title">TADOKU.ORG</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://pyrsshub.vercel.app/tadoku/books/l0" target="_blank">https://pyrsshub.vercel.app/tadoku/books/l0</a></p>
<p class="card-text">路由:<code>/tadoku/books/:category</code></p>
<p class="card-text">参数category [必填难度等级l0、l1、l2、l3、l4、l5 ]</p>
</div>
</div>
<br>
<!--item info end-->
<!--item info start-->
<div class="card text-left">
<div class="card-body">