Skip to content

Commit

Permalink
docs: add require config for coolapk (#17197)
Browse files Browse the repository at this point in the history
  • Loading branch information
xizeyoupan authored Oct 19, 2024
1 parent 4505df7 commit 090f8f3
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 10 deletions.
8 changes: 7 additions & 1 deletion lib/routes/coolapk/dyh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ export const route: Route = {
example: '/coolapk/dyh/1524',
parameters: { dyhId: '看看号ID' },
features: {
requireConfig: false,
requireConfig: [
{
name: 'ALLOW_USER_HOTLINK_TEMPLATE',
optional: true,
description: '设置为`true`并添加`image_hotlink_template`参数来代理图片',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
Expand Down
8 changes: 7 additions & 1 deletion lib/routes/coolapk/hot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ export const route: Route = {
example: '/coolapk/hot',
parameters: { type: '默认为`jrrm`', period: '默认为`daily`' },
features: {
requireConfig: false,
requireConfig: [
{
name: 'ALLOW_USER_HOTLINK_TEMPLATE',
optional: true,
description: '设置为`true`并添加`image_hotlink_template`参数来代理图片',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
Expand Down
8 changes: 7 additions & 1 deletion lib/routes/coolapk/huati.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ export const route: Route = {
example: '/coolapk/huati/iPhone',
parameters: { tag: '话题名称' },
features: {
requireConfig: false,
requireConfig: [
{
name: 'ALLOW_USER_HOTLINK_TEMPLATE',
optional: true,
description: '设置为`true`并添加`image_hotlink_template`参数来代理图片',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
Expand Down
6 changes: 6 additions & 0 deletions lib/routes/coolapk/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: '酷安',
url: 'coolapk.com',
description: `
:::tip
即日起,多数路由图片防盗链。
需要将 \`ALLOW_USER_HOTLINK_TEMPLATE\` 环境变量设置为 \`true\` ,然后配置\`image_hotlink_template\` 。
详见 [#16715](https://github.com/DIYgod/RSSHub/issues/16715)
:::`,
};
8 changes: 7 additions & 1 deletion lib/routes/coolapk/toutiao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ export const route: Route = {
example: '/coolapk/toutiao',
parameters: { type: '默认为history' },
features: {
requireConfig: false,
requireConfig: [
{
name: 'ALLOW_USER_HOTLINK_TEMPLATE',
optional: true,
description: '设置为`true`并添加`image_hotlink_template`参数来代理图片',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
Expand Down
15 changes: 10 additions & 5 deletions lib/routes/coolapk/tuwen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ import got from '@/utils/got';
import utils from './utils';

export const route: Route = {
path: ['/tuwen/:type?', '/tuwen-xinxian'],
path: ['/tuwen/:type?'],
categories: ['social-media'],
example: '/coolapk/tuwen',
parameters: { type: '默认为hot' },
features: {
requireConfig: false,
requireConfig: [
{
name: 'ALLOW_USER_HOTLINK_TEMPLATE',
optional: true,
description: '设置为`true`并添加`image_hotlink_template`参数来代理图片',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
Expand All @@ -25,16 +31,15 @@ export const route: Route = {

async function handler(ctx) {
const type = ctx.req.param('type') || 'hot';
const requestPath = ctx.req.path;
let feedTitle;
const fullUrl = new URL('/v6/page/dataList', utils.base_url);
if (requestPath.startsWith('/coolapk/tuwen-xinxian') || type === 'latest') {
if (type === 'latest') {
// 实时
fullUrl.searchParams.append('url', `/feed/digestList?${new URLSearchParams('cacheExpires=300&type=12&message_status=all&is_html_article=1&filterEmptyPicture=1&filterTag=二手交易,酷安自贸区,薅羊毛小分队').toString()}`);
fullUrl.searchParams.append('title', '新鲜图文');
fullUrl.searchParams.append('subTitle', '');
feedTitle = '酷安 - 新鲜图文';
} else if (requestPath.startsWith('/coolapk/tuwen')) {
} else {
// 精选
fullUrl.searchParams.append('url', `#/feed/digestList?${new URLSearchParams('type=12&is_html_article=1&recommend=3,4').toString()}`);
fullUrl.searchParams.append('title', '图文');
Expand Down
8 changes: 7 additions & 1 deletion lib/routes/coolapk/user-dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ export const route: Route = {
example: '/coolapk/user/3177668/dynamic',
parameters: { uid: '在个人界面右上分享-复制链接获取' },
features: {
requireConfig: false,
requireConfig: [
{
name: 'ALLOW_USER_HOTLINK_TEMPLATE',
optional: true,
description: '设置为`true`并添加`image_hotlink_template`参数来代理图片',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
Expand Down

0 comments on commit 090f8f3

Please sign in to comment.