From 6590c9ef96cdcb0f0a882100b0d0bc220e54bf8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=99=8E=E6=95=85=E6=B4=9E?= <55782476+TigerCubDen@users.noreply.github.com> Date: Sat, 20 Feb 2021 16:34:44 +0800 Subject: [PATCH] feat(radar): add Fur Affinity radar rules (#6930) * Update social-media.md * Update social-media.md * Update social-media.md * Update radar-rules.js * [CodeFactor] Apply fixes [ci skip] [skip ci] * Update social-media.md * Update status.js * Update shouts.js * Update browse.js * Update commissions.js * Update favorites.js * Update gallery.js * Update home.js * Update journals.js * [CodeFactor] Apply fixes to commit 7ee8b39 [ci skip] [skip ci] * Update scraps.js * Update search.js * Update status.js * Update user.js * [CodeFactor] Apply fixes to commit 579e817 [ci skip] [skip ci] * Update watchers.js * Update watching.js * Update watching.js * Update radar-rules.js * Update social-media.md * Update search.js * Update search.js * Update social-media.md * Update social-media.md * Update social-media.md * Update social-media.md * Update social-media.md Co-authored-by: codefactor-io Co-authored-by: NeverBehave --- assets/radar-rules.js | 96 ++++++++++++++++++ docs/en/social-media.md | 140 +++++++++++++------------- docs/social-media.md | 140 +++++++++++++------------- lib/routes/furaffinity/browse.js | 3 +- lib/routes/furaffinity/commissions.js | 2 +- lib/routes/furaffinity/favorites.js | 2 +- lib/routes/furaffinity/gallery.js | 3 +- lib/routes/furaffinity/home.js | 2 +- lib/routes/furaffinity/journals.js | 3 +- lib/routes/furaffinity/scraps.js | 2 +- lib/routes/furaffinity/search.js | 8 +- lib/routes/furaffinity/shouts.js | 6 +- lib/routes/furaffinity/status.js | 4 +- lib/routes/furaffinity/user.js | 10 +- lib/routes/furaffinity/watchers.js | 3 +- lib/routes/furaffinity/watching.js | 3 +- 16 files changed, 259 insertions(+), 168 deletions(-) diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 8798d1815..f3a8600b2 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -2714,4 +2714,100 @@ }, ], }, + 'furaffinity.net': { + _name: 'Fur Affinity', + www: [ + { + title: '主页', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/', + target: '/furaffinity/home', + }, + { + title: '浏览', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/browse/', + target: '/furaffinity/browse', + + }, + { + title: '站点状态', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/', + target: '/furaffinity/status', + }, + { + title: '搜索', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/search/', + target: (params, url) => `/furaffinity/search/${new URL(url).searchParams.get('q')}`, + }, + { + title: '用户主页简介', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/user/:username/', + target: '/furaffinity/user/:username', + }, + { + title: '用户关注列表', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/watchlist/by/:username/', + target: '/furaffinity/watching/:username', + }, + { + title: '用户被关注列表', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/watchlist/to/:username/', + target: '/furaffinity/watchers/:username', + }, + { + title: '用户接受委托信息', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/commissions/:username/', + target: '/furaffinity/commissions/:username', + }, + { + title: '用户的Shouts留言', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/user/:username/', + target: '/furaffinity/user/:username', + }, + { + title: '用户的日记', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/journals/:username/', + target: '/furaffinity/journals/:username', + }, + { + title: '用户的创作画廊', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/gallery/:username/', + target: '/furaffinity/gallery/:username', + }, + { + title: '用户非正式作品', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/scraps/:username/', + target: '/furaffinity/scraps/:username', + }, + { + title: '用户的喜爱列表', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/favorites/:username/', + target: '/furaffinity/favorites/:username', + }, + { + title: '作品评论区', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/view/:id/', + target: '/furaffinity/submission_comments/:id', + }, + { + title: '日记评论区', + docs: 'https://docs.rsshub.app/social-media.html#fur-affinity', + source: '/journal/:id/', + target: '/furaffinity/journal_comments/:id', + }, + ], + }, }); diff --git a/docs/en/social-media.md b/docs/en/social-media.md index 1e262026e..00784d53b 100644 --- a/docs/en/social-media.md +++ b/docs/en/social-media.md @@ -34,6 +34,76 @@ pageClass: routes +## Fur Affinity + +### Home + + + +Type + +| artwork | crafts | music | writing | +| ---- | ---- | ---- | ---- | +| artwork | crafts | music | writing | + + + +### Browse + + + +### Website Status + + + +### Userpage Profile + + + +### Search + + + +### User's Watching List + + + +### User's Watcher List + + + +### User's Commission Information + + + +### User's Shouts + + + +### User's Journals + + + +### User's Gallery + + + +### User's Scraps + + + +### User's Favorites + + + +### Submission Comments + + + +### Journal Comments + + + ## Gab ### User's Posts @@ -275,73 +345,3 @@ YouTube provides official RSS feeds for channels, for instance - -## Fur Affinity - -### Home - - - -Type - -| artwork | crafts | music | writing | -| ---- | ---- | ---- | ---- | -| artwork | crafts | music | writing | - - - -### Browse - - - -### Website Status - - - -### Userpage Profile - - - -### Search - - - -### User's Watching List - - - -### User's Watcher List - - - -### User's Commission Information - - - -### User's Shouts - - - -### User's Journals - - - -### User's Gallery - - - -### User's Scraps - - - -### User's Favorites - - - -### Submission Comments - - - -### Journal Comments - - diff --git a/docs/social-media.md b/docs/social-media.md index e4818132f..05dcd32de 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -320,6 +320,76 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性 +## Fur Affinity + +### 主页 + + + +类型 type + +| 艺术品 | 手工 | 音乐 | 写作 | +| ---- | ---- | ---- | ---- | +| artwork | crafts | music | writing | + + + +### 浏览 + + + +### 站点状态 + + + +### 搜索 + + + +### 用户主页简介 + + + +### 用户关注列表 + + + +### 用户被关注列表 + + + +### 用户接受委托信息 + + + +### 用户的Shouts留言 + + + +### 用户的日记 + + + +### 用户的创作画廊 + + + +### 用户的零碎(非正式)作品 + + + +### 用户的喜爱列表 + + + +### 作品评论区 + + + +### 日记评论区 + + + ## Gab ### 用戶時間線 @@ -1174,79 +1244,11 @@ rule ### 用户关注时间线 - + ::: warning 注意 用户关注动态需要登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。 ::: -## Fur Affinity - -### 主页 - - - -类型 type - -| 艺术品 | 手工制品 | 音乐 | 文学 | -| ---- | ---- | ---- | ---- | -| artwork | crafts | music | writing | - - -### 浏览 - - - -### 站点状态 - - - -### 搜索 - - - -### 用户主页简介 - - - -### 用户关注列表 - - - -### 用户被关注列表 - - - -### 用户接受委托信息 - - - -### 用户的Shouts留言 - - - -### 用户的日记 - - - -### 用户的创作画廊 - - - -### 用户的零碎(非正式)作品 - - - -### 用户的喜爱列表 - - - -### 作品评论区 - - - -### 日记评论区 - - diff --git a/lib/routes/furaffinity/browse.js b/lib/routes/furaffinity/browse.js index 421979185..97186a32b 100644 --- a/lib/routes/furaffinity/browse.js +++ b/lib/routes/furaffinity/browse.js @@ -1,6 +1,5 @@ const got = require('@/utils/got'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const nsfw = String(ctx.params.nsfw); @@ -10,7 +9,7 @@ module.exports = async (ctx) => { if (nsfw === '1') { url = 'https://faexport.spangle.org.uk/browse.json'; } - + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: url, diff --git a/lib/routes/furaffinity/commissions.js b/lib/routes/furaffinity/commissions.js index f763c336b..c2a21eecc 100644 --- a/lib/routes/furaffinity/commissions.js +++ b/lib/routes/furaffinity/commissions.js @@ -1,10 +1,10 @@ const got = require('@/utils/got'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const username = String(ctx.params.username); + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: `https://faexport.spangle.org.uk/user/${username}/commissions.json`, diff --git a/lib/routes/furaffinity/favorites.js b/lib/routes/furaffinity/favorites.js index d94b8f76e..98aad063e 100644 --- a/lib/routes/furaffinity/favorites.js +++ b/lib/routes/furaffinity/favorites.js @@ -1,7 +1,6 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const nsfw = String(ctx.params.nsfw); @@ -13,6 +12,7 @@ module.exports = async (ctx) => { url = `https://faexport.spangle.org.uk/user/${username}/favorites.rss`; } + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: url, diff --git a/lib/routes/furaffinity/gallery.js b/lib/routes/furaffinity/gallery.js index 73869cdc7..c924bab54 100644 --- a/lib/routes/furaffinity/gallery.js +++ b/lib/routes/furaffinity/gallery.js @@ -1,7 +1,6 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const nsfw = String(ctx.params.nsfw); @@ -12,7 +11,7 @@ module.exports = async (ctx) => { if (nsfw === '1') { url = `https://faexport.spangle.org.uk/user/${username}/gallery.rss`; } - + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: url, diff --git a/lib/routes/furaffinity/home.js b/lib/routes/furaffinity/home.js index e1815b2a2..af439384a 100644 --- a/lib/routes/furaffinity/home.js +++ b/lib/routes/furaffinity/home.js @@ -1,6 +1,5 @@ const got = require('@/utils/got'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const type = String(ctx.params.type); @@ -12,6 +11,7 @@ module.exports = async (ctx) => { url = 'https://faexport.spangle.org.uk/home.json'; } + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: url, diff --git a/lib/routes/furaffinity/journals.js b/lib/routes/furaffinity/journals.js index a5048499f..4c8de7ce7 100644 --- a/lib/routes/furaffinity/journals.js +++ b/lib/routes/furaffinity/journals.js @@ -1,12 +1,11 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const username = String(ctx.params.username); - // 添加参数username + // 添加参数username 和 发起 HTTP GET 请求 const response = await got({ method: 'get', url: `https://faexport.spangle.org.uk/user/${username}/journals.rss`, diff --git a/lib/routes/furaffinity/scraps.js b/lib/routes/furaffinity/scraps.js index b76509dd3..f3581f4d0 100644 --- a/lib/routes/furaffinity/scraps.js +++ b/lib/routes/furaffinity/scraps.js @@ -1,7 +1,6 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const nsfw = String(ctx.params.nsfw); @@ -13,6 +12,7 @@ module.exports = async (ctx) => { url = `https://faexport.spangle.org.uk/user/${username}/scraps.rss`; } + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: url, diff --git a/lib/routes/furaffinity/search.js b/lib/routes/furaffinity/search.js index a1bd237dc..536799709 100644 --- a/lib/routes/furaffinity/search.js +++ b/lib/routes/furaffinity/search.js @@ -1,7 +1,6 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const nsfw = String(ctx.params.nsfw); @@ -9,10 +8,11 @@ module.exports = async (ctx) => { // 添加参数keyword以及判断传入的参数nsfw let url = `https://faexport.spangle.org.uk/search.rss?q=${keyword}?sfw=1`; - if (nsfw === '1' || keyword === '1') { + if (nsfw === '1') { url = `https://faexport.spangle.org.uk/search.rss?q=${keyword}`; } + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: url, @@ -31,11 +31,11 @@ module.exports = async (ctx) => { ctx.state.data = { // 源标题 - title: `FA ${keyword}'s Search List`, + title: `FA Search List of ${keyword}`, // 源链接 link: `https://www.furaffinity.net/search/?q=${keyword}`, // 源说明 - description: `Fur Affinity ${keyword}'s Search List`, + description: `Fur Affinity Search List of ${keyword}`, // 遍历此前获取的数据 item: diff --git a/lib/routes/furaffinity/shouts.js b/lib/routes/furaffinity/shouts.js index 96df0d4ff..01651aeba 100644 --- a/lib/routes/furaffinity/shouts.js +++ b/lib/routes/furaffinity/shouts.js @@ -1,10 +1,10 @@ const got = require('@/utils/got'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const username = String(ctx.params.username); - + + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: `https://faexport.spangle.org.uk/user/${username}/shouts.json`, @@ -28,7 +28,7 @@ module.exports = async (ctx) => { // 标题 title: item.text, // 正文 - description: `
${item.text} `, + description: `
${item.name}: ${item.text} `, // 链接 link: `https://www.furaffinity.net/user/${username}/`, // 作者 diff --git a/lib/routes/furaffinity/status.js b/lib/routes/furaffinity/status.js index f996edf38..2ec4566a6 100644 --- a/lib/routes/furaffinity/status.js +++ b/lib/routes/furaffinity/status.js @@ -1,7 +1,7 @@ const got = require('@/utils/got'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { + // 发起 HTTP GET 请求 const response = await got({ method: 'get', url: `https://faexport.spangle.org.uk/status.json`, @@ -15,7 +15,7 @@ module.exports = async (ctx) => { let description = ''; if (Object.keys(data)[0] === "online") { - description = `Status: ${Object.keys(data)[0]}
Guests: ${status.guests}
Registered: ${status.registered}
Other: ${status.other}
Total: ${status.total}
Fa Server Time: ${data.fa_server_time}
Fa Server Time at: ${data.fa_server_time_at} `; + description = `Status: ${Object.keys(data)[0]}
Guests: ${status.guests}
Registered: ${status.registered}
Other: ${status.other}
Total: ${status.total}
Fa Server Time: ${data.fa_server_time}`; } else { description = "offline"; } diff --git a/lib/routes/furaffinity/user.js b/lib/routes/furaffinity/user.js index 4afe8c33d..9d0b731ef 100644 --- a/lib/routes/furaffinity/user.js +++ b/lib/routes/furaffinity/user.js @@ -1,10 +1,10 @@ const got = require('@/utils/got'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const username = String(ctx.params.username); - // 添加参数username + + // 添加参数username 和 发起 HTTP GET 请求 const response = await got({ method: 'get', url: `https://faexport.spangle.org.uk/user/${username}.json`, @@ -16,7 +16,6 @@ module.exports = async (ctx) => { const data = response.data; // 收集传入的数据 - const id = data.id; const name = data.name; const profile = data.profile; const account_type = data.profile; @@ -25,7 +24,6 @@ module.exports = async (ctx) => { const artist_type = data.artist_type; const user_title = data.user_title; const registered_since = data.registered_since; - const registered_at = data.registered_at; const current_mood = data.current_mood; const artist_profile = data.artist_profile; const pageviews = data.pageviews; @@ -71,9 +69,9 @@ module.exports = async (ctx) => { } } - const description = `Id: ${id}
Name: ${name}
Profile: ${profile}
Account Type: ${account_type}
+ const description = `Name: ${name}
Profile: ${profile}
Account Type: ${account_type}
Avatar: ${avatar}
Full Name: ${full_name}
Artist Type: ${artist_type}
User Title: ${user_title}
- Registered Since: ${registered_since}
Registered at: ${registered_at}
Current Mood: ${current_mood}

Artist Profile:
${artist_profile}

+ Registered Since: ${registered_since}
Current Mood: ${current_mood}

Artist Profile:
${artist_profile}

Pageviews: ${pageviews}
Submissions: ${submissions}
Comments_Received: ${comments_received}
Comments Given: ${comments_given}
Journals: ${journals}
Favorite: ${favorite}

Artist Information:
Species: ${species}
Personal Quote: ${personal_quote}
Music Type/Genre: ${music_type_genre}
Favorite Movie: ${favorites_movie}
Favorite Game: ${favorites_game}
Favorite Game Platform: ${favorites_game_platform}
Favorite Artist: ${favorites_artist}
diff --git a/lib/routes/furaffinity/watchers.js b/lib/routes/furaffinity/watchers.js index 076f2fbfb..a02a2befe 100644 --- a/lib/routes/furaffinity/watchers.js +++ b/lib/routes/furaffinity/watchers.js @@ -1,11 +1,10 @@ const got = require('@/utils/got'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const username = String(ctx.params.username); - // 添加参数username + // 添加参数username 和 发起 HTTP GET 请求 const response = await got({ method: 'get', url: `https://faexport.spangle.org.uk/user/${username}/watchers.json`, diff --git a/lib/routes/furaffinity/watching.js b/lib/routes/furaffinity/watching.js index 9cb898fb9..9532320b4 100644 --- a/lib/routes/furaffinity/watching.js +++ b/lib/routes/furaffinity/watching.js @@ -1,11 +1,10 @@ const got = require('@/utils/got'); -// 发起 HTTP GET 请求 module.exports = async (ctx) => { // 传入参数 const username = String(ctx.params.username); - // 添加参数username + // 添加参数username 和 发起 HTTP GET 请求 const response = await got({ method: 'get', url: `https://faexport.spangle.org.uk/user/${username}/watching.json`,