mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-17 07:26:49 +00:00
techcrunch
This commit is contained in:
@@ -49,6 +49,6 @@ flask run
|
|||||||
|
|
||||||
### 部署到Heroku
|
### 部署到Heroku
|
||||||
|
|
||||||
[](https://heroku.com/deploy?template=https://github.com/alphardex/RSSHub-python)
|
[](https://heroku.com/deploy?template=https://github.com/hillerliao/RSSHub-python)
|
||||||
|
|
||||||
记得在环境变量中把FLASK_CONFIG设为production
|
记得在环境变量中把FLASK_CONFIG设为production
|
||||||
|
|||||||
@@ -114,4 +114,9 @@ def cls_subject(category=''):
|
|||||||
@bp.route('/chaindd/column/<string:category>')
|
@bp.route('/chaindd/column/<string:category>')
|
||||||
def chaindd_column(category=''):
|
def chaindd_column(category=''):
|
||||||
from rsshub.spiders.chaindd.column import ctx
|
from rsshub.spiders.chaindd.column import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
|
@bp.route('/techcrunch/tag/<string:category>')
|
||||||
|
def techcrunch_tag(category=''):
|
||||||
|
from rsshub.spiders.techcrunch.tag import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|||||||
28
rsshub/spiders/techcrunch/tag.py
Normal file
28
rsshub/spiders/techcrunch/tag.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
|
||||||
|
domain = 'https://techcrunch.com'
|
||||||
|
|
||||||
|
def parse(post):
|
||||||
|
item = {}
|
||||||
|
item['title'] = post['title']['rendered']
|
||||||
|
item['description'] = post['content']['rendered']
|
||||||
|
item['link'] = post['link']
|
||||||
|
item['pubDate'] = post['date_gmt']
|
||||||
|
return item
|
||||||
|
|
||||||
|
def ctx(category=''):
|
||||||
|
url = f'{domain}/wp-json/tc/v1/magazine?tags={category}'
|
||||||
|
res = requests.get(url, headers=DEFAULT_HEADERS)
|
||||||
|
res = json.loads(res.text)
|
||||||
|
posts = res
|
||||||
|
print(posts)
|
||||||
|
items = list(map(parse, posts))
|
||||||
|
return {
|
||||||
|
'title': f'{category} - tag - Techcrunch',
|
||||||
|
'description': f'{category} - tag - Techcrunch',
|
||||||
|
'link': f'f{domain}/tag/fintech/',
|
||||||
|
'author': f'hillerliao',
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user