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: infzm timezone #7695

Merged
merged 2 commits into from
Nov 27, 2021
Merged

fix: infzm timezone #7695

merged 2 commits into from
Nov 27, 2021

Conversation

SeanChao
Copy link
Contributor

该 PR 相关 Issue / Involved issue

Close #

完整路由地址 / Example for the proposed route(s)

/infzm/5

新RSS检查列表 / New RSS Script Checklist

  • 这个PR中包含了新的路由吗? Does this PR add new route?
    • 如果有, 请完成检查列表. If yes, please finish the check list
    • 如果你的PR符合下方某个事项, 也请注明. If any of the checklist item meets your PR, please fill it out.
    • <- 这样打勾
  • 是否提供了文档? Documentation provided?
    • 是否提供了英文文档? EN Documentation provided?
  • 是否支持全文获取? Is this RSS Script support fulltext?
    • 如果全文获取中需要访问文章链接, 是否使用了缓存? If fulltext requires to fetch detail pages, is cache used in the process?
    • 缓存说明 | How to use cache
  • 目标是否有明显的反爬/频率限制? Is there any sign of anti-bot or rate limit?
    • 如果有, 是否有对应的措施? (延长缓存时间, 写文档说明, etc.) If yes, do your code reflect this sign? (e.g. write documentations, use long cache time)
  • 目标是否有提供日期? Is there a date in the source?
    • 如果有,包是否正确解析? If there is, can this script provide this info?
    • 如果有提供解析能力,时区是否正确调整? Is the timezone correctly provided?
    • 如果有提供日期,但是没有提供解析,请说明原因 If there is a date but this script does not parse, please provide your reason.
  • 是否引入的新的包? Any new package introduced?
    • 如果有, 请说明原因. If yes, please state your reason
  • 是否使用了Puppeteer? Make use of Puppeteer?
    • 如果有, 请说明原因. If yes, please state your reason

说明 / Note

This commit fixed the previously unhandled timezone issue.

@vercel
Copy link

vercel bot commented Jun 14, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/rsshub-team/rsshub/HRQ9pYL2kBfX1uZXFsQPYiNj27yj
✅ Preview: https://rsshub-git-fork-seanchao-fix-infzm-timezone-rsshub-team.vercel.app

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-do-not-use-3b9kji9wi-diy.vercel.app/infzm/5 - 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>http://www.infzm.com/contents?term_id=5</link>
        <atom:link href="https://rsshub-do-not-use-3b9kji9wi-diy.vercel.app/infzm/5" rel="self" type="application/rss+xml" />
        <description><![CDATA[南方周末-生活 - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>[email protected] (DIYgod)</webMaster>
        
        
        
        <language>zh-cn</language>
        
        <lastBuildDate>Mon, 14 Jun 2021 14:53:20 GMT</lastBuildDate>
        <ttl>5</ttl>
        
        <item>
            <title><![CDATA[小城故事  | 小城居民]]></title>
            <description><![CDATA[<p class="contentImg image"><img src="http://images.infzm.com/cms/medias/image/21/06/13/KMt68igC96VO95Nlb5KJPVn7mfSO2ILYxoLq9Ko6.jpeg" border="0" class="landscape" width="900" height="599" data-src="//images.infzm.com/cms/medias/image/21/06/13/KMt68igC96VO95Nlb5KJPVn7mfSO2ILYxoLq9Ko6.jpeg" data-key="147933" referrerpolicy="no-referrer"></p><p style="color: #999; text-align: center;" class="cm_pic_caption">(图文无关)县城四通八达的公路通向这个或那个乡镇、村庄,在县城和乡村之间存在着绝对自然的过渡。图为云南建水县火车站,乘客正在上车。 <span class="cm_pic_author" style="color: #aaa;">(南方周末记者 冯飞/图)</span></p><p>我十几岁时去了新加坡,当地同学会问我来自哪个城市,他们通常会提供两个选项:上海?北京?那是1996年,国外对中国很不了解,就算是深圳这样的城市,对他们来说也很陌生。整个中国被划分为两块:北京、上海和“其他地方”。所以,我得对他们解释,我来自一个county,美国的county称为郡,中国的county叫县城。</p><p>在中国,大城市人看县城,就当是“城乡接合部”。对于把自己当半个乡下人,县城人多半是不服气的,他们会说:县城再小,也是个“城”,我们都是拿工资、吃“商品粮”的。在县城人眼里,只有种田、住村里的居民才是乡下人。</p><p>十八线小城里的居民虽然不服气,但到了省城或京城,他们又会觉得“怯”,担心自己身上流露出乡气。在小城居民身上,的确兼有城市和乡村居民的作派习气,因为小城和乡村那么临近,城镇居民和乡下亲</p><p></p>]]></description>
            <pubDate>Mon, 14 Jun 2021 08:00:00 GMT</pubDate>
            <guid isPermaLink="false">http://www.infzm.com/contents/207832</guid>
            <link>http://www.infzm.com/contents/207832</link>
            
            
            
            <author><![CDATA[张惠雯]]></author>
            

@github-actions github-actions bot added the Auto: Route Test Complete Auto route test has finished on given PR label Jun 14, 2021
@@ -16,7 +17,8 @@ module.exports = async (ctx) => {
const data = response.data.data;
const resultItem = await Promise.all(
data.contents.map(async ({ id, subject, author, publish_time }) => {
const date = new Date(publish_time);
// the timezone is GMT+8
const date = parseDate(`${publish_time}+0800`, 'YYYY-MM-DD HH:mm:SSZZ');
Copy link
Contributor

Choose a reason for hiding this comment

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

这个日期格式化的行为是不是不太对啊?如果你想解析时区,推荐用 https://docs.rsshub.app/joinus/pub-date.html#shi-yong-gong-ju-lei-timezone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我参考过这个链接,因为网站上显示的时间一定是东八区的,我按照 dayjs 提供的格式硬设为东八区了。不这样处理可能会因为服务器时区的不同产生错误的时间

Copy link
Collaborator

Choose a reason for hiding this comment

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

那使用工具类会产生错误的结果吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这样处理后就没问题了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

当时的问题是,因为网页上用的时区总是GMT+8,如果这里不处理,生成的 RSS feed 就丢失了时区信息,在阅读器里就会看到错误的时间

Copy link
Contributor

Choose a reason for hiding this comment

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

工具类一样可以设置时区

Copy link
Contributor Author

Choose a reason for hiding this comment

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

你们是说用 timezone 来设置时区吗?我当时只看了 dayjs 所以没有用,我可以试一下

Copy link
Contributor Author

Choose a reason for hiding this comment

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

之前没仔细看链接的 anchor,抱歉了

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-maizmks0g-rsshub-team.vercel.app/infzm/5 - 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>http://www.infzm.com/contents?term_id=5</link>
        <atom:link href="https://rsshub-maizmks0g-rsshub-team.vercel.app/infzm/5" rel="self" type="application/rss+xml" />
        <description><![CDATA[南方周末-生活 - Made with love by RSSHub(https://github.com/DIYgod/RSSHub)]]></description>
        <generator>RSSHub</generator>
        <webMaster>[email protected] (DIYgod)</webMaster>
        
        
        
        <language>zh-cn</language>
        
        <lastBuildDate>Sat, 14 Aug 2021 03:12:11 GMT</lastBuildDate>
        <ttl>5</ttl>
        
        <item>
            <title><![CDATA[瞬间一周丨东京奥运会闭幕]]></title>
            <description><![CDATA[<p>2021年8月8日,东京奥运会闭幕式在新国立竞技场举行。</p><p>日前,澳大利亚国立大学研究人员发表公报说,他们与多国研究人员合作,捕捉到了超新星爆发的“最初景象”。这是天文学家第一次细致地观测到完整的超新星爆发过程,有助于研究宇宙起源。</p><p class="contentImg image"><img src="http://images.infzm.com/cms/medias/image/21/08/12/t1xCm51rUJg7qaZaGVXsQWiUcIQyG5ILYW7HxSSL.jpeg" border="0" class="landscape" width="960" height="567" data-src="//images.infzm.com/cms/medias/image/21/08/12/t1xCm51rUJg7qaZaGVXsQWiUcIQyG5ILYW7HxSSL.jpeg" data-key="155588" referrerpolicy="no-referrer"></p><p style="color: #999; text-align: center;" class="cm_pic_caption">2021年8月8日,东京奥运会闭幕式</p><p></p>]]></description>
            <pubDate>Thu, 12 Aug 2021 09:04:02 GMT</pubDate>
            <guid isPermaLink="false">http://www.infzm.com/contents/211513</guid>
            <link>http://www.infzm.com/contents/211513</link>
            
            
            
            <author><![CDATA[综合]]></author>
            

@DIYgod DIYgod merged commit 5b36e0b into DIYgod:master Nov 27, 2021
auto-bot-ty added a commit to auto-bot-ty/RSSHub that referenced this pull request Nov 27, 2021
* docs: update sponsor

* feat: add hotukdeals

* feat: hotukdeals radar

* feat: add PS5 stock UK - The Independent

* fix(route): allow preLoginFlow of instagram to fail (DIYgod#8340)

Based on discussion in instragram-private-api repo, we do not need
this function for login.

See:
dilame/instagram-private-api#1411
dilame/instagram-private-api#1417

* style: auto format

* feat: pixiv PIXIV_IMG_PROXY

* fix: douban guid

* feat(route): add Research Gate Publications (DIYgod#7544)

* feat(route): add QuestMobile行业研究报告 (DIYgod#7552)

* chore: remove no-return-await eslint rule

* feat(route): add RSS3 Blog (DIYgod#7566)

Co-authored-by: DIYgod <[email protected]>

* style: auto format

* feat(route): add Odaily星球日报活动 (DIYgod#7666)

* feat: remove toutiao

* chore: format

* feat(route): add fashion network news (DIYgod#7602)

Co-authored-by: DIYgod <[email protected]>

* feat(route): add dbaplus社群活动 (DIYgod#7584)

Co-authored-by: DIYgod <[email protected]>

* feat(route): add 德阳考试中心 (DIYgod#7901)

* feat(route): add 央视网栏目 (DIYgod#7937)

Co-authored-by: DIYgod <[email protected]>

* style: auto format

* fix: infzm timezone (DIYgod#7695)

* fix: undefined error when no magnet & torrent (DIYgod#7745)

* feat(route): add World Health Organization News (DIYgod#8022)

Co-authored-by: DIYgod <[email protected]>

* fix: exclude datanews to prevent `pubDate` error (`/caixin/latest`) (DIYgod#8068)

* feat(route): add World Health Organization Speeches (DIYgod#8048)

Co-authored-by: DIYgod <[email protected]>

* Fix AP News article's title (DIYgod#8086)

* feat(route): add Now 熱門新聞 (DIYgod#8093)

Co-authored-by: DIYgod <[email protected]>

* feat(route): add Uwants (DIYgod#8094)

Co-authored-by: DIYgod <[email protected]>

* fix: lazyloadRouteHandler

* fix: add Lofter话题/标签文章分类 & 视频 (DIYgod#8054)

* feat(route): add yunnan normal university (DIYgod#8097)

* feat(route): add 香港討論區 (DIYgod#8101)

Co-authored-by: DIYgod <[email protected]>

* feat(route): add 香港高登 (DIYgod#8109)

Co-authored-by: DIYgod <[email protected]>

* feat(route): add 华南理工大学教务处学院通知 (DIYgod#8110)

* fix(route): incorrect source links in yuzu emulator (DIYgod#8111)

* fix(route): migrate initium routes to new timezone (DIYgod#8124)

* feat(route): add yahoo japan covid19 news collection 日本疫情消息汇总 (DIYgod#8099)

* feat(route): add Asian to lick (DIYgod#8156)

Co-authored-by: SettingDust <[email protected]>
Co-authored-by: DIYgod <[email protected]>

* feat(route): add "micmicidol" (DIYgod#8070)

Co-authored-by: SettingDust <[email protected]>
Co-authored-by: DIYgod <[email protected]>

* feat(route):add 拷贝漫画 (DIYgod#7896)

Co-authored-by: SettingDust <[email protected]>
Co-authored-by: DIYgod <[email protected]>

* feat(route): add SBS中文 (DIYgod#8149)

Co-authored-by: DIYgod <[email protected]>

* feat(route): add Netflix Newsroom (DIYgod#8135)

Co-authored-by: SettingDust <[email protected]>
Co-authored-by: NeverBehave <[email protected]>
Co-authored-by: DIYgod <[email protected]>

* fix(route): 修正北京教育考试院内容提取错误 (DIYgod#8209)

* fix(route): dekudeals error due to ad (DIYgod#8214)

* feat(route): add 旺球体育直播间 (DIYgod#8276)

Co-authored-by: DIYgod <[email protected]>

* fix(route): 深圳证券交易所最新规则 (DIYgod#8284)

* feat(route): add 人民网领导留言板 (DIYgod#8285)

* feat(router): timednews 时刻新闻 (DIYgod#8279)

Co-authored-by: Tony <[email protected]>

* feat(router): ccac 澳门廉政公署 (DIYgod#8273)

Co-authored-by: Tony <[email protected]>

* add 安全文摘 (DIYgod#8294)

Co-authored-by: testkaili <[email protected]>
Co-authored-by: kaiili <[email protected]>

* feat(router): cebbank 光大银行 (DIYgod#8293)

* feat(route): add NGOCN (DIYgod#8301)

Co-authored-by: DIYgod <[email protected]>

* chore: format

* feat(route): add IT之家专题 (DIYgod#8312)

* feat(route)(v2): add 旅法师营地首页 (DIYgod#8350)

* feat(route): add 辛華社 (DIYgod#8357)

* feat(route): add Literotica Category (DIYgod#8415)

* feat(route): add Literotica News Stories (DIYgod#8410)

Co-authored-by: DIYgod <[email protected]>

* misc: add NOROUTE instruction back to template (DIYgod#8379)

Co-authored-by: Sukka <[email protected]>

* feat(route): jandan use the origin gif instead the thumbs (DIYgod#8406)

* feat(route): add HKJunkCall資訊中心 (DIYgod#8405)

* fix(route): fix furstar pic href (DIYgod#8404)

* feat(route): add ScienceDirect Journal (DIYgod#8399)

* feat(route): add Harvard Business Review Topic (DIYgod#8395)

* fix(route)(hket): migrate to v2 (DIYgod#8132)

* chore: format

Co-authored-by: DIYgod <[email protected]>
Co-authored-by: Shizun Ge <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Ethan Shen <[email protected]>
Co-authored-by: DIYgod <[email protected]>
Co-authored-by: zytomorrow <[email protected]>
Co-authored-by: Sean Chao <[email protected]>
Co-authored-by: junfengP <[email protected]>
Co-authored-by: Toby Tso <[email protected]>
Co-authored-by: ninboy <[email protected]>
Co-authored-by: SettingDust <[email protected]>
Co-authored-by: Rongrong <[email protected]>
Co-authored-by: coxde <[email protected]>
Co-authored-by: sgqy <[email protected]>
Co-authored-by: KotoriK <[email protected]>
Co-authored-by: btdwv <[email protected]>
Co-authored-by: NeverBehave <[email protected]>
Co-authored-by: erriy <[email protected]>
Co-authored-by: Kevin Carter <[email protected]>
Co-authored-by: linbuxiao <[email protected]>
Co-authored-by: Tony <[email protected]>
Co-authored-by: kaiili <[email protected]>
Co-authored-by: testkaili <[email protected]>
Co-authored-by: kaiili <[email protected]>
Co-authored-by: auto-bot-ty <[email protected]>
Co-authored-by: Yishuai Li <[email protected]>
Co-authored-by: Sukka <[email protected]>
Co-authored-by: Oddcc <[email protected]>
Co-authored-by: tuzi3040 <[email protected]>
@SeanChao SeanChao deleted the fix-infzm-timezone branch November 29, 2021 12:45
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants