feat: pixiv PIXIV_IMG_PROXY
This commit is contained in:
parent
608e073b50
commit
53f6347189
|
|
@ -480,6 +480,8 @@ See docs of specified route and `lib/config.js` for detail information.
|
|||
|
||||
- `PIXIV_BYPASS_DOH`: DNS over HTTPS endpoint, it must be compatible with Cloudflare or Google DoH JSON schema, defaults to `https://1.1.1.1/dns-query`
|
||||
|
||||
- `PIXIV_IMG_PROXY`: Used as a proxy for image addresses, as pixiv images have anti-theft, default to `https://i.pixiv.cat`
|
||||
|
||||
- pixiv fanbox: Get paid content
|
||||
|
||||
- `FANBOX_SESSION_ID`: equals to `FANBOXSESSID` in site cookies.
|
||||
|
|
|
|||
|
|
@ -508,6 +508,8 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行
|
|||
|
||||
- `PIXIV_BYPASS_DOH`: 用于解析 `PIXIV_BYPASS_HOSTNAME` 的 DoH 端点 URL,需要兼容 Cloudflare 或 Google 的 DoH 服务的 JSON 查询格式,默认为 `https://1.1.1.1/dns-query`
|
||||
|
||||
- `PIXIV_IMG_PROXY`: 用于图片地址的代理,因为 pixiv 图片有防盗链,默认为 `https://i.pixiv.cat`
|
||||
|
||||
- pixiv fanbox 用于获取付费内容
|
||||
|
||||
- `FANBOX_SESSION_ID`: 对应 cookies 中的`FANBOXSESSID`。
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ const calculateValue = () => {
|
|||
bypassCdn: envs.PIXIV_BYPASS_CDN !== '0' && envs.PIXIV_BYPASS_CDN !== 'false',
|
||||
bypassCdnHostname: envs.PIXIV_BYPASS_HOSTNAME || 'public-api.secure.pixiv.net',
|
||||
bypassCdnDoh: envs.PIXIV_BYPASS_DOH || 'https://1.1.1.1/dns-query',
|
||||
imgProxy: envs.PIXIV_IMG_PROXY || 'https://i.pixiv.cat',
|
||||
},
|
||||
fanbox: {
|
||||
session: envs.FANBOX_SESSION_ID,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ const getToken = require('./token');
|
|||
const getBookmarks = require('./api/getBookmarks');
|
||||
const getUserDetail = require('./api/getUserDetail');
|
||||
const config = require('@/config').value;
|
||||
const pixivUtils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
if (!config.pixiv || !config.pixiv.refreshToken) {
|
||||
|
|
@ -25,14 +26,7 @@ module.exports = async (ctx) => {
|
|||
link: `https://www.pixiv.net/users/${id}/bookmarks/artworks`,
|
||||
description: `${username} 的 pixiv 最新收藏`,
|
||||
item: illusts.map((illust) => {
|
||||
const images = [];
|
||||
if (illust.page_count === 1) {
|
||||
images.push(`<p><img src='https://pixiv.cat/${illust.id}.jpg'/></p>`);
|
||||
} else {
|
||||
for (let i = 0; i < illust.page_count; i++) {
|
||||
images.push(`<p><img src='https://pixiv.cat/${illust.id}-${i + 1}.jpg'/></p>`);
|
||||
}
|
||||
}
|
||||
const images = pixivUtils.getImgs(illust);
|
||||
return {
|
||||
title: illust.title,
|
||||
author: illust.user.name,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
const getToken = require('./token');
|
||||
const getIllustFollows = require('./api/getIllustFollows');
|
||||
const config = require('@/config').value;
|
||||
const pixivUtils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
if (!config.pixiv || !config.pixiv.refreshToken) {
|
||||
throw 'pixiv RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
|
||||
|
|
@ -18,14 +20,7 @@ module.exports = async (ctx) => {
|
|||
link: 'https://www.pixiv.net/bookmark_new_illust.php',
|
||||
description: `Pixiv关注的画师们的最新作品`,
|
||||
item: illusts.map((illust) => {
|
||||
const images = [];
|
||||
if (illust.page_count === 1) {
|
||||
images.push(`<p><img src='https://pixiv.cat/${illust.id}.jpg'/></p>`);
|
||||
} else {
|
||||
for (let i = 0; i < illust.page_count; i++) {
|
||||
images.push(`<p><img src='https://pixiv.cat/${illust.id}-${i + 1}.jpg'/></p>`);
|
||||
}
|
||||
}
|
||||
const images = pixivUtils.getImgs(illust);
|
||||
return {
|
||||
title: illust.title,
|
||||
author: illust.user.name,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const getToken = require('./token');
|
||||
const getRanking = require('./api/getRanking');
|
||||
const config = require('@/config').value;
|
||||
const pixivUtils = require('./utils');
|
||||
|
||||
const titles = {
|
||||
day: 'pixiv 日排行',
|
||||
|
|
@ -71,14 +72,7 @@ module.exports = async (ctx) => {
|
|||
link: links[mode],
|
||||
description: dateStr + titles[mode],
|
||||
item: illusts.map((illust, index) => {
|
||||
const images = [];
|
||||
if (illust.page_count === 1) {
|
||||
images.push(`<p><img src="https://pixiv.cat/${illust.id}.jpg"/></p>`);
|
||||
} else {
|
||||
for (let i = 0; i < illust.page_count; i++) {
|
||||
images.push(`<p><img src="https://pixiv.cat/${illust.id}-${i + 1}.jpg"/></p>`);
|
||||
}
|
||||
}
|
||||
const images = pixivUtils.getImgs(illust);
|
||||
return {
|
||||
title: `#${index + 1} ${illust.title}`,
|
||||
pubDate: new Date(illust.create_date).toUTCString(),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ const getToken = require('./token');
|
|||
const searchPopularIllust = require('./api/searchPopularIllust');
|
||||
const searchIllust = require('./api/searchIllust');
|
||||
const config = require('@/config').value;
|
||||
const pixivUtils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
if (!config.pixiv || !config.pixiv.refreshToken) {
|
||||
|
|
@ -35,14 +36,7 @@ module.exports = async (ctx) => {
|
|||
title: `${keyword} 的 pixiv ${order === 'popular' ? '热门' : ''}内容`,
|
||||
link: `https://www.pixiv.net/tags/${keyword}/artworks`,
|
||||
item: illusts.map((illust) => {
|
||||
const images = [];
|
||||
if (illust.page_count === 1) {
|
||||
images.push(`<p><img src="https://pixiv.cat/${illust.id}.jpg"/></p>`);
|
||||
} else {
|
||||
for (let i = 0; i < illust.page_count; i++) {
|
||||
images.push(`<p><img src="https://pixiv.cat/${illust.id}-${i + 1}.jpg"/></p>`);
|
||||
}
|
||||
}
|
||||
const images = pixivUtils.getImgs(illust);
|
||||
return {
|
||||
title: illust.title,
|
||||
author: illust.user.name,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const getToken = require('./token');
|
||||
const getIllusts = require('./api/getIllusts');
|
||||
const config = require('@/config').value;
|
||||
const pixivUtils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
if (!config.pixiv || !config.pixiv.refreshToken) {
|
||||
|
|
@ -23,14 +24,7 @@ module.exports = async (ctx) => {
|
|||
link: `https://www.pixiv.net/users/${id}`,
|
||||
description: `${username} 的 pixiv 最新动态`,
|
||||
item: illusts.map((illust) => {
|
||||
const images = [];
|
||||
if (illust.page_count === 1) {
|
||||
images.push(`<p><img src='https://pixiv.cat/${illust.id}.jpg'/></p>`);
|
||||
} else {
|
||||
for (let i = 0; i < illust.page_count; i++) {
|
||||
images.push(`<p><img src='https://pixiv.cat/${illust.id}-${i + 1}.jpg'/></p>`);
|
||||
}
|
||||
}
|
||||
const images = pixivUtils.getImgs(illust);
|
||||
return {
|
||||
title: illust.title,
|
||||
author: username,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
const config = require('@/config').value;
|
||||
|
||||
module.exports = {
|
||||
getImgs(illust) {
|
||||
const images = [];
|
||||
if (illust.meta_pages?.length) {
|
||||
for (let i = 0; i < illust.meta_pages.length; i++) {
|
||||
const original = illust.meta_pages[i].image_urls.original.replace('https://i.pximg.net', config.pixiv.imgProxy);
|
||||
images.push(`<p><img src="${original}"/></p>`);
|
||||
}
|
||||
} else if (illust.meta_single_page.original_image_url) {
|
||||
const original = illust.meta_single_page.original_image_url.replace('https://i.pximg.net', config.pixiv.imgProxy);
|
||||
images.push(`<p><img src="${original}"/></p>`);
|
||||
}
|
||||
return images;
|
||||
},
|
||||
};
|
||||
Loading…
Reference in New Issue