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

feat-wordpress: add cdn for http images #6790

Merged
merged 5 commits into from
Jan 27, 2021
Merged

Conversation

duhd1993
Copy link
Contributor

@duhd1993 duhd1993 commented Jan 26, 2021

该 PR 相关 Issue / Involved issue

Close #

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

/blogs/wordpress/wjd.name/http

Note: this blog is just a random blog from google for demo

新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)
  • 是否引入的新的包? Any new package introduced?
    • 如果有, 请说明原因. If yes, please state your reason
  • 是否使用了Puppeteer? Make use of Puppeteer?
    • 如果有, 请说明原因. If yes, please state your reason

说明 / Note

I want to subscribe a wordpress blog without https. Images won't load because chrome upgrades the embeded figures to https. By redirecting images with a cdn, it also get rid of some anti-hotlink issues.

@vercel
Copy link

vercel bot commented Jan 26, 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/diy/rsshub/iie8iy7zt
✅ Preview: https://rsshub-git-fork-lonelykid-wordpress.diy.vercel.app

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-2r5wf15df.vercel.app/blogs/wordpress/wjd.name/http/1 - 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://wjd.name</link>
        <atom:link href="https://rsshub-2r5wf15df.vercel.app/blogs/wordpress/wjd.name/http/1" 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>Tue, 26 Jan 2021 01:03:12 GMT</lastBuildDate>
        <ttl>5</ttl>
        
        <item>
            <title><![CDATA[2021年第一天——新年愿望&旧年年鉴]]></title>
            <description><![CDATA[<p>魔幻的2020年终于结束了,是否魔幻的2021年开始了呢?这一年年过得。按照惯例,每年的第一天发布上一年的个人年鉴以及新一年的愿望!继续愿望优先!</p>
<p><img loading="lazy" class="alignnone size-full wp-image-15343" src="https://images.weserv.nl/?url=http://img.wjd.name/wp-content/uploads/2020/12/yearbook.jpg" alt width="500" height="328" referrerpolicy="no-referrer"></p>
<p><span id="more-15342"></span></p>
<h1><strong>冬瓜2021年新年愿望如下</strong>:</h1>
<p><strong>自己和身边的人身体都要健康</strong><br clear="none"><br clear="none"><strong>感情一切安好</strong><br clear="none"><br clear="none"><strong>完成国内全部省市打卡</strong><br clear="none"><br clear="none"><strong>能出境旅行,不管去哪里</strong><br clear="none"><br clear="none"><strong>看50部电影、10本书</strong><br clear="none"><br clear="none"><strong>多多锻炼,体重保持</strong><br clear="none"><br clear="none"><strong>工作切换,顺顺利利</strong><br clear="none"><br clear="none"><strong>打新成功,资产增值</strong><br clear="none"><br clear="none"><strong>全球疫情,一起结束</strong></p>
<p><strong>人间多一点善良</strong></p>
<p> </p>
<h1><strong>冬瓜2020年个人年鉴</strong>:</h1>
<p>1月1日 新年愿望<br>

@github-actions github-actions bot added the Auto: Route Test Complete Auto route test has finished on given PR label Jan 26, 2021
@@ -2,6 +2,9 @@ const parser = require('@/utils/rss-parser');

module.exports = async (ctx) => {
const scheme = ctx.params.https || 'https';
const cdnList = ['https://imageproxy.pimg.tw/resize?url=', 'https://images.weserv.nl/?url=', 'https://pic1.xuehuaimg.com/proxy/', 'https://cors.netnr.workers.dev/'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个设置应当在配置内进行
参考: f187ff9

Copy link
Contributor Author

Choose a reason for hiding this comment

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

明白了。这样就不方便白嫖rsshub.app了😂。我改一下再提交。

Copy link
Collaborator

Choose a reason for hiding this comment

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

如果有相关需求建议去 #6671 提噢
未来这些修订可能都会调整

Copy link
Contributor Author

Choose a reason for hiding this comment

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

留了一个基于cloudflare的url作为默认,我找到的都是基于cloudflare和akamai这两家cdn的,如有国内访问更友好的请告知。另外还是在url留了个开关。

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-q3pn6x6tq.vercel.app/blogs/wordpress/wjd.name/http/1 - 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://wjd.name</link>
        <atom:link href="https://rsshub-q3pn6x6tq.vercel.app/blogs/wordpress/wjd.name/http/1" 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>Tue, 26 Jan 2021 02:24:28 GMT</lastBuildDate>
        <ttl>5</ttl>
        
        <item>
            <title><![CDATA[2021年第一天——新年愿望&旧年年鉴]]></title>
            <description><![CDATA[<p>魔幻的2020年终于结束了,是否魔幻的2021年开始了呢?这一年年过得。按照惯例,每年的第一天发布上一年的个人年鉴以及新一年的愿望!继续愿望优先!</p>
<p><img loading="lazy" class="alignnone size-full wp-image-15343" src="https://images.weserv.nl/?url=http://img.wjd.name/wp-content/uploads/2020/12/yearbook.jpg" alt width="500" height="328" referrerpolicy="no-referrer"></p>
<p><span id="more-15342"></span></p>
<h1><strong>冬瓜2021年新年愿望如下</strong>:</h1>
<p><strong>自己和身边的人身体都要健康</strong><br clear="none"><br clear="none"><strong>感情一切安好</strong><br clear="none"><br clear="none"><strong>完成国内全部省市打卡</strong><br clear="none"><br clear="none"><strong>能出境旅行,不管去哪里</strong><br clear="none"><br clear="none"><strong>看50部电影、10本书</strong><br clear="none"><br clear="none"><strong>多多锻炼,体重保持</strong><br clear="none"><br clear="none"><strong>工作切换,顺顺利利</strong><br clear="none"><br clear="none"><strong>打新成功,资产增值</strong><br clear="none"><br clear="none"><strong>全球疫情,一起结束</strong></p>
<p><strong>人间多一点善良</strong></p>
<p> </p>
<h1><strong>冬瓜2020年个人年鉴</strong>:</h1>
<p>1月1日 新年愿望<br>

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-bi50lq48x.vercel.app/blogs/wordpress/wjd.name/http/1 - 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://wjd.name</link>
        <atom:link href="https://rsshub-bi50lq48x.vercel.app/blogs/wordpress/wjd.name/http/1" 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>Tue, 26 Jan 2021 02:29:33 GMT</lastBuildDate>
        <ttl>5</ttl>
        
        <item>
            <title><![CDATA[2021年第一天——新年愿望&旧年年鉴]]></title>
            <description><![CDATA[<p>魔幻的2020年终于结束了,是否魔幻的2021年开始了呢?这一年年过得。按照惯例,每年的第一天发布上一年的个人年鉴以及新一年的愿望!继续愿望优先!</p>
<p><img loading="lazy" class="alignnone size-full wp-image-15343" src="https://images.weserv.nl/?url=http://img.wjd.name/wp-content/uploads/2020/12/yearbook.jpg" alt width="500" height="328" referrerpolicy="no-referrer"></p>
<p><span id="more-15342"></span></p>
<h1><strong>冬瓜2021年新年愿望如下</strong>:</h1>
<p><strong>自己和身边的人身体都要健康</strong><br clear="none"><br clear="none"><strong>感情一切安好</strong><br clear="none"><br clear="none"><strong>完成国内全部省市打卡</strong><br clear="none"><br clear="none"><strong>能出境旅行,不管去哪里</strong><br clear="none"><br clear="none"><strong>看50部电影、10本书</strong><br clear="none"><br clear="none"><strong>多多锻炼,体重保持</strong><br clear="none"><br clear="none"><strong>工作切换,顺顺利利</strong><br clear="none"><br clear="none"><strong>打新成功,资产增值</strong><br clear="none"><br clear="none"><strong>全球疫情,一起结束</strong></p>
<p><strong>人间多一点善良</strong></p>
<p> </p>
<h1><strong>冬瓜2020年个人年鉴</strong>:</h1>
<p>1月1日 新年愿望<br>

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-76zo57qh9.vercel.app/blogs/wordpress/wjd.name/http/1 - **Failed**
    HttpError: <!DOCTYPE html><html><head><title>Error in RSSHub!</title><style>body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:16px;color:#2c3e50}.content{width:800px;margin:100px auto 0;text-align:center}.message{white-space:pre-wrap;text-align:left}a{color:#f5712c}</style></head><body><div class="content"><p><img src="https://i.loli.net/2019/09/04/lmBbNQoLzrKGgiM.jpg" alt="RSSHub" width="120"></p><h1>Looks like something went wrong</h1><pre class="message">Route requested: /blogs/wordpress/wjd.name/http/1</pre><pre class="message">Error message: wrong path</pre><div style="margin:50px 0"><p>在线文档与支持,请访问<a href="https://docs.rsshub.app/" target="_blank">docs.rsshub.app</a>。</p><p>For online documentation and support please refer to <a href="https://docs.rsshub.app/" target="_blank">docs.rsshub.app</a>.</p></div></div></body></html>

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-76zo57qh9.vercel.app/blogs/wordpress/wjd.name/http/1 - **Failed**
    HttpError: <!DOCTYPE html><html><head><title>Error in RSSHub!</title><style>body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:16px;color:#2c3e50}.content{width:800px;margin:100px auto 0;text-align:center}.message{white-space:pre-wrap;text-align:left}a{color:#f5712c}</style></head><body><div class="content"><p><img src="https://i.loli.net/2019/09/04/lmBbNQoLzrKGgiM.jpg" alt="RSSHub" width="120"></p><h1>Looks like something went wrong</h1><pre class="message">Route requested: /blogs/wordpress/wjd.name/http/1</pre><pre class="message">Error message: wrong path</pre><div style="margin:50px 0"><p>在线文档与支持,请访问<a href="https://docs.rsshub.app/" target="_blank">docs.rsshub.app</a>。</p><p>For online documentation and support please refer to <a href="https://docs.rsshub.app/" target="_blank">docs.rsshub.app</a>.</p></div></div></body></html>

docs/blog.md Outdated
@@ -90,6 +90,16 @@ pageClass: routes

<Route author="Lonor" example="/blogs/wordpress/lawrence.code.blog" path="/blogs/wordpress/:domain/:https?" :paramsDesc="['WordPress 博客域名', '默认 https 协议。填写 `http`或`https`']"/>

可通过`WORDPRESS_CDN`定义链接,替换 http 图片链接为 https 链接,可供考虑的服务有:
Copy link
Collaborator

Choose a reason for hiding this comment

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

请将说明放置在install.md

@github-actions
Copy link
Contributor

Successfully generated as following:

https://rsshub-iie8iy7zt.vercel.app/blogs/wordpress/wjd.name/http - 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://wjd.name</link>
        <atom:link href="https://rsshub-iie8iy7zt.vercel.app/blogs/wordpress/wjd.name/http" 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>Wed, 27 Jan 2021 00:40:50 GMT</lastBuildDate>
        <ttl>5</ttl>
        
        <item>
            <title><![CDATA[2021年第一天——新年愿望&旧年年鉴]]></title>
            <description><![CDATA[<p>魔幻的2020年终于结束了,是否魔幻的2021年开始了呢?这一年年过得。按照惯例,每年的第一天发布上一年的个人年鉴以及新一年的愿望!继续愿望优先!</p>
<p><img loading="lazy" class="alignnone size-full wp-image-15343" src="http://img.wjd.name/wp-content/uploads/2020/12/yearbook.jpg" alt width="500" height="328" referrerpolicy="no-referrer"></p>
<p><span id="more-15342"></span></p>
<h1><strong>冬瓜2021年新年愿望如下</strong>:</h1>
<p><strong>自己和身边的人身体都要健康</strong><br clear="none"><br clear="none"><strong>感情一切安好</strong><br clear="none"><br clear="none"><strong>完成国内全部省市打卡</strong><br clear="none"><br clear="none"><strong>能出境旅行,不管去哪里</strong><br clear="none"><br clear="none"><strong>看50部电影、10本书</strong><br clear="none"><br clear="none"><strong>多多锻炼,体重保持</strong><br clear="none"><br clear="none"><strong>工作切换,顺顺利利</strong><br clear="none"><br clear="none"><strong>打新成功,资产增值</strong><br clear="none"><br clear="none"><strong>全球疫情,一起结束</strong></p>
<p><strong>人间多一点善良</strong></p>
<p> </p>
<h1><strong>冬瓜2020年个人年鉴</strong>:</h1>
<p>1月1日 新年愿望<br>

Copy link
Collaborator

@NeverBehave NeverBehave left a comment

Choose a reason for hiding this comment

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

LGTM

@NeverBehave NeverBehave merged commit fdfbc06 into DIYgod:master Jan 27, 2021
@duhd1993 duhd1993 deleted the wordpress branch January 27, 2021 02:30
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.

2 participants