mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-16 15:09:28 +00:00
add app store top app
This commit is contained in:
@@ -225,12 +225,16 @@ def bjnews_channel(category=''):
|
|||||||
from rsshub.spiders.bjnews.channel import ctx
|
from rsshub.spiders.bjnews.channel import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
|
@bp.route('/appstore/top/<string:cc>/<string:genreid>')
|
||||||
|
def appstore_top(cc='', genreid=''):
|
||||||
|
from rsshub.spiders.appstore.top import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx(cc,genreid)))
|
||||||
|
|
||||||
@bp.route('/filter/')
|
@bp.route('/filter/')
|
||||||
def rss_filter():
|
def rss_filter():
|
||||||
from rsshub.spiders.rssfilter.filter import ctx
|
from rsshub.spiders.rssfilter.filter import ctx
|
||||||
feed_url = request.args.get("feed")
|
feed_url = request.args.get("feed")
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(feed_url)))
|
return render_template('main/atom.xml', **filter_content(ctx(feed_url)))
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@bp.route('/test')
|
@bp.route('/test')
|
||||||
@bp.route('/test/测试')
|
@bp.route('/test/测试')
|
||||||
|
|||||||
64
rsshub/spiders/appstore/top.py
Normal file
64
rsshub/spiders/appstore/top.py
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import json
|
||||||
|
import requests
|
||||||
|
|
||||||
|
domain = 'https://itunes.apple.com'
|
||||||
|
|
||||||
|
countries = {"CN": "143465-19",
|
||||||
|
"US": "143441-1",
|
||||||
|
"JP": "143462-9",
|
||||||
|
"KR": "143466-13",
|
||||||
|
"HK": "143463-18",
|
||||||
|
"AU": "143460",
|
||||||
|
"TW": "143470-18",
|
||||||
|
"CA": "143455-6",
|
||||||
|
"DK": "143458-2",
|
||||||
|
"RU": "143469-16",
|
||||||
|
"ID": "143476-2",
|
||||||
|
"TR": "143480-2",
|
||||||
|
"GR": "143448-2",
|
||||||
|
"DE": "143443-4",
|
||||||
|
"IT": "143450-7",
|
||||||
|
"NO": "143457-2",
|
||||||
|
"FR": "143442-3",
|
||||||
|
"TH": "143475-2",
|
||||||
|
"SE": "143456-17",
|
||||||
|
"FI": "143447-2",
|
||||||
|
"GB": "143444",
|
||||||
|
"NL": "143452-10",
|
||||||
|
"BR": "143503-15",
|
||||||
|
"PT": "143453-24",
|
||||||
|
"MX": "143468-28",
|
||||||
|
"ES": "143454-8",
|
||||||
|
"VN": "143471-2"}
|
||||||
|
|
||||||
|
def gen_headers(cc=''):
|
||||||
|
headers = {
|
||||||
|
"Accept-Language": f"{cc}",
|
||||||
|
"User-Agent": "AppStore/2.0 iOS/10.2 model/iPhone6,1 hwp/s5l8960x build/14C92 (6; dt:89)",
|
||||||
|
'Accept': '*/*' ,
|
||||||
|
'X-Apple-Store-Front': f'{countries[cc.upper()]},29' ,
|
||||||
|
}
|
||||||
|
return headers
|
||||||
|
|
||||||
|
def parse(post):
|
||||||
|
item = {}
|
||||||
|
subtitle = post['name'] + ': ' + post['subtitle'] if post.__contains__('subtitle') else post['name']
|
||||||
|
item['title'] = post['name']
|
||||||
|
item['description'] = subtitle + '</br></br>开发者: ' + '<a href="' + post['artistUrl'] + '">' + post['artistName'] + '</a> ' \
|
||||||
|
+ '</br></br>Rating: ' + str( post['userRating']['value'] ) \
|
||||||
|
+ ',数量:' + str( post['userRating']['ratingCount'] )
|
||||||
|
item['link'] = post['shortUrl']
|
||||||
|
return item
|
||||||
|
|
||||||
|
def ctx(cc='', genreid=''):
|
||||||
|
top_url = f"{domain}/WebObjects/MZStore.woa/wa/viewTop?cc={cc}&genreId={genreid}&l=en"
|
||||||
|
res = requests.get(top_url, headers=gen_headers(cc)).json()
|
||||||
|
posts = res['storePlatformData']['lockup']['results'].values()
|
||||||
|
|
||||||
|
return {
|
||||||
|
'title': f'Top Apps in {cc} - App Store',
|
||||||
|
'link': top_url,
|
||||||
|
'description': f'Top Apps in {cc} - App Store',
|
||||||
|
'author': 'hillerliao',
|
||||||
|
'items': list(map(parse, posts))
|
||||||
|
}
|
||||||
@@ -42,6 +42,19 @@
|
|||||||
<br>
|
<br>
|
||||||
<!--item info end-->
|
<!--item info end-->
|
||||||
|
|
||||||
|
<!--item info start-->
|
||||||
|
<div class="card text-left">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4 class="card-title">Top App - App Store</h4>
|
||||||
|
<h6 class="text-muted">Top App <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/appstore/top/us/36" target="_blank">https://pyrsshub.vercel.app/appstore/top/us/36</a></p>
|
||||||
|
<p class="card-text">路由:<code>/appstore/top/:countrycode/:genreid</code></p>
|
||||||
|
<p class="card-text">参数:countrycode,国家/地区代码, 如 us、cn、ru、br;genreid,类别,如 36, 6000,6014,6026,更多详见 https://t.ly/vYJI</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<!--item info end-->
|
||||||
|
|
||||||
<div class="card text-left">
|
<div class="card text-left">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">传送门-失效</h4>
|
<h4 class="card-title">传送门-失效</h4>
|
||||||
|
|||||||
Reference in New Issue
Block a user