From 6a3cfe0cfe3218dc6194e68e72ff91f436005988 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Jul 2022 21:43:06 +0000 Subject: [PATCH 1/3] Bump lxml from 4.7.1 to 4.9.1 Bumps [lxml](https://github.com/lxml/lxml) from 4.7.1 to 4.9.1. - [Release notes](https://github.com/lxml/lxml/releases) - [Changelog](https://github.com/lxml/lxml/blob/master/CHANGES.txt) - [Commits](https://github.com/lxml/lxml/compare/lxml-4.7.1...lxml-4.9.1) --- updated-dependencies: - dependency-name: lxml dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4d85427..35127c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ icecream==2.1.1 idna==3.3 itsdangerous==2.0.1 Jinja2==3.0.3 -lxml==4.7.1 +lxml==4.9.1 MarkupSafe==2.0.1 parsel==1.6.0 Pygments==2.11.1 From f1e054d16c388a9bda646ebfe2f8e0232c713632 Mon Sep 17 00:00:00 2001 From: Hiller Liao Date: Sat, 6 Aug 2022 17:19:02 +0800 Subject: [PATCH 2/3] add app store top app --- rsshub/blueprints/main.py | 6 ++- rsshub/spiders/appstore/top.py | 64 ++++++++++++++++++++++++++++++++ rsshub/templates/main/feeds.html | 13 +++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 rsshub/spiders/appstore/top.py diff --git a/rsshub/blueprints/main.py b/rsshub/blueprints/main.py index ebbf49e..5c27542 100644 --- a/rsshub/blueprints/main.py +++ b/rsshub/blueprints/main.py @@ -225,12 +225,16 @@ def bjnews_channel(category=''): from rsshub.spiders.bjnews.channel import ctx return render_template('main/atom.xml', **filter_content(ctx(category))) +@bp.route('/appstore/top//') +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/') 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/测试') diff --git a/rsshub/spiders/appstore/top.py b/rsshub/spiders/appstore/top.py new file mode 100644 index 0000000..9ffef73 --- /dev/null +++ b/rsshub/spiders/appstore/top.py @@ -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 + '

开发者: ' + '' + post['artistName'] + ' ' \ + + '

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)) + } \ No newline at end of file diff --git a/rsshub/templates/main/feeds.html b/rsshub/templates/main/feeds.html index d39f63d..a46962a 100644 --- a/rsshub/templates/main/feeds.html +++ b/rsshub/templates/main/feeds.html @@ -42,6 +42,19 @@
+ +
+
+

Top App - App Store

+
Top App by hillerliao
+

举例:https://pyrsshub.vercel.app/appstore/top/us/36

+

路由:/appstore/top/:countrycode/:genreid

+

参数:countrycode,国家/地区代码, 如 us、cn、ru、br;genreid,类别,如 36, 6000,6014,6026,更多详见 https://t.ly/vYJI

+
+
+
+ +

传送门-失效

From e5a859f6fbc31367e0581a0aa3d9a3a3d1a524c6 Mon Sep 17 00:00:00 2001 From: Hiller Liao Date: Sat, 6 Aug 2022 20:02:36 +0800 Subject: [PATCH 3/3] add discord server for pyrsshub --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 68d4660..5dfd97b 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,16 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇 本项目是[原RSSHub](https://github.com/DIYgod/RSSHub)的Python实现。 + **其实用Python写爬虫要比JS更方便:p** DEMO地址:https://rsshub.deta.dev + +## 交流 + +Discord Server: [https://discord.gg/tAMMRUMS](https://discord.gg/tAMMRUMS) + ## RSS过滤 你可以通过以下查询字符串来过滤RSS的内容: