Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(parameter): adjust to filter before limit. #13682

Merged
merged 3 commits into from
Nov 3, 2023
Merged

fix(parameter): adjust to filter before limit. #13682

merged 3 commits into from
Nov 3, 2023

Conversation

honue
Copy link
Contributor

@honue honue commented Nov 2, 2023

Involved Issue / 该 PR 相关 Issue

Close #

Example for the Proposed Route(s) / 路由地址示例

/test/filter-limit?filterout_title=2&limit=2

New RSS Route Checklist / 新 RSS 路由检查表

  • New Route / 新的路由
  • Documentation / 文档说明
    • EN / 英文文档
    • CN / 中文文档
  • Full text / 全文获取
    • Use cache / 使用缓存
  • Anti-bot or rate limit / 反爬/频率限制
    • If yes, do your code reflect this sign? / 如果有, 是否有对应的措施?
  • Date and time / 日期和时间
    • Parsed / 可以解析
    • Correct time zone / 时区正确
  • New package added / 添加了新的包
  • Puppeteer

Note / 说明

#13674 (reply in thread)

@github-actions github-actions bot added core enhancement Auto: Route Test Complete Auto route test has finished on given PR labels Nov 2, 2023
Copy link
Contributor

github-actions bot commented Nov 2, 2023

Successfully generated as following:

http://localhost:1200/douban/list/tv_american?limit=5&filterout_description=纪录片|同性|真人秀|动画 - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
>
    <channel>
        <title><![CDATA[豆瓣 - 近期热门美剧]]></title>
        <link>https://m.douban.com/subject_collection/tv_american</link>
        <atom:link href="http://localhost:1200/douban/list/tv_american?limit=5&#38;filterout_description=%E7%BA%AA%E5%BD%95%E7%89%87|%E5%90%8C%E6%80%A7|%E7%9C%9F%E4%BA%BA%E7%A7%80|%E5%8A%A8%E7%94%BB" rel="self" type="application/rss+xml" />
        <description><![CDATA[豆瓣 - 近期热门美剧 - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>i@diygod.me (DIYgod)</webMaster>
        <language>zh-cn</language>
        <lastBuildDate>Thu, 02 Nov 2023 15:04:35 GMT</lastBuildDate>
        <ttl>5</ttl>
        <item>
            <title><![CDATA[V世代 第一季]]></title>
            <description><![CDATA[<p>V世代 第一季</p>
<p>8.7</p>
<p>2023 / 美国 / 剧情 喜剧 动作 科幻 冒险 / 尼尔森·克拉格 史蒂夫·博伊姆 蕾切尔·高德伯格 萨娜·汉姆利 克莱尔·基尔纳 菲利浦·斯格里西亚 莎娜·史坦 / 洁丝·辛克莱 钱斯·佩尔多莫</p>
]]></description>
            <guid isPermaLink="false">V世代 第一季</guid>
            <link></link>
        </item>
        <item>
            <title><![CDATA[性爱自修室 第四季]]></title>
            <description><![CDATA[<p>性爱自修室 第四季</p>
<p>7.5</p>
<p>2023 / 英国 / 剧情 喜剧 / 多米尼克·勒克莱尔 米歇尔·萨维尔 艾丽莎·麦克克莱兰 / 阿萨·巴特菲尔德 吉莲·安德森</p>
]]></description>
            <guid isPermaLink="false">性爱自修室 第四季</guid>
            <link></link>
        </item>
        <item>
            <title><![CDATA[尸体]]></title>
            <description><![CDATA[<p>尸体</p>
<p>7.4</p>
<p>2023 / 英国 / 悬疑 惊悚 / 马可·克罗伊茨派因特纳 王昊鹭 / 斯蒂芬·格拉汉姆 希拉·哈斯</p>
]]></description>
            <guid isPermaLink="false">尸体</guid>
            <link></link>
        </item>
        <item>
            <title><![CDATA[厄舍府的崩塌]]></title>
            <description><![CDATA[<p>厄舍府的崩塌</p>
<p>7.7</p>
<p>2023 / 美国 / 剧情 恐怖 / 迈克·弗拉纳根 迈克尔·费穆格纳瑞 / 卡拉·古奇诺 布鲁斯·格林伍德</p>
]]></description>
            <guid isPermaLink="false">厄舍府的崩塌</guid>
            <link></link>
        </item>
        <item>
            <title><![CDATA[洛基 第二季]]></title>
            <description><![CDATA[<p>洛基 第二季</p>
<p>8.5</p>
<p>2023 / 美国 / 科幻 奇幻 / 贾斯汀·本森 艾伦·穆尔黑德 / 汤姆·希德勒斯顿 索菲娅·迪·马蒂诺</p>
]]></description>
            <guid isPermaLink="false">洛基 第二季</guid>
            <link></link>
        </item>
    </channel>
</rss>

Copy link
Collaborator

@TonyRL TonyRL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to have a test case so #13674 (reply in thread) won't happen again during refactoring.

You can take a look at https://github.com/DIYgod/RSSHub/blob/master/lib/v2/test/index.js and https://github.com/DIYgod/RSSHub/blob/master/test/middleware/parameter.js

@honue
Copy link
Contributor Author

honue commented Nov 3, 2023

A test case has been added. The default 6 test items are used, so index.js has not been modified.

Copy link
Contributor

github-actions bot commented Nov 3, 2023

Successfully generated as following:

http://localhost:1200/test/filter-limit?filterout_title=2&limit=2 - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
>
    <channel>
        <title><![CDATA[Test filter-limit]]></title>
        <link>https://github.com/DIYgod/RSSHub</link>
        <atom:link href="http://localhost:1200/test/filter-limit?filterout_title=2&#38;limit=2" rel="self" type="application/rss+xml" />
        <description><![CDATA[A test route for RSSHub - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>i@diygod.me (DIYgod)</webMaster>
        <language>zh-cn</language>
        <lastBuildDate>Fri, 03 Nov 2023 01:51:33 GMT</lastBuildDate>
        <ttl>5</ttl>
        <item>
            <title><![CDATA[Title1]]></title>
            <description><![CDATA[Description1]]></description>
            <pubDate>Mon, 31 Dec 2018 15:59:50 GMT</pubDate>
            <guid isPermaLink="false">https://github.com/DIYgod/RSSHub/issues/1</guid>
            <link>https://github.com/DIYgod/RSSHub/issues/1</link>
            <author><![CDATA[DIYgod1]]></author>
        </item>
        <item>
            <title><![CDATA[Title3]]></title>
            <description><![CDATA[Description3]]></description>
            <pubDate>Mon, 31 Dec 2018 15:59:30 GMT</pubDate>
            <guid isPermaLink="false">https://github.com/DIYgod/RSSHub/issues/3</guid>
            <link>https://github.com/DIYgod/RSSHub/issues/3</link>
            <author><![CDATA[DIYgod3]]></author>
        </item>
    </channel>
</rss>

@honue
Copy link
Contributor Author

honue commented Nov 3, 2023

I don't know if the description of the test case is appropriate, should I use "filter before limit" or keep it?

@TonyRL
Copy link
Collaborator

TonyRL commented Nov 3, 2023

use "filter before limit"

Sure.

Copy link
Contributor

github-actions bot commented Nov 3, 2023

Successfully generated as following:

http://localhost:1200/test/filter-limit?filterout_title=2&limit=2 - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
>
    <channel>
        <title><![CDATA[Test filter-limit]]></title>
        <link>https://github.com/DIYgod/RSSHub</link>
        <atom:link href="http://localhost:1200/test/filter-limit?filterout_title=2&#38;limit=2" rel="self" type="application/rss+xml" />
        <description><![CDATA[A test route for RSSHub - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>i@diygod.me (DIYgod)</webMaster>
        <language>zh-cn</language>
        <lastBuildDate>Fri, 03 Nov 2023 03:46:21 GMT</lastBuildDate>
        <ttl>5</ttl>
        <item>
            <title><![CDATA[Title1]]></title>
            <description><![CDATA[Description1]]></description>
            <pubDate>Mon, 31 Dec 2018 15:59:50 GMT</pubDate>
            <guid isPermaLink="false">https://github.com/DIYgod/RSSHub/issues/1</guid>
            <link>https://github.com/DIYgod/RSSHub/issues/1</link>
            <author><![CDATA[DIYgod1]]></author>
        </item>
        <item>
            <title><![CDATA[Title3]]></title>
            <description><![CDATA[Description3]]></description>
            <pubDate>Mon, 31 Dec 2018 15:59:30 GMT</pubDate>
            <guid isPermaLink="false">https://github.com/DIYgod/RSSHub/issues/3</guid>
            <link>https://github.com/DIYgod/RSSHub/issues/3</link>
            <author><![CDATA[DIYgod3]]></author>
        </item>
    </channel>
</rss>

@TonyRL TonyRL merged commit 9002602 into DIYgod:master Nov 3, 2023
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto: Route Test Complete Auto route test has finished on given PR core enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants