forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #629 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
12 changed files
with
161 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/profile/:id': ['TonyRL'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
const timezone = require('@/utils/timezone'); | ||
const { fixArticleContent } = require('@/utils/wechat-mp'); | ||
const baseUrl = 'https://freewechat.com'; | ||
|
||
module.exports = async (ctx) => { | ||
const { id } = ctx.params; | ||
const url = `${baseUrl}/profile/${id}`; | ||
const { data: response } = await got(url); | ||
const $ = cheerio.load(response); | ||
const author = $('h2').text().trim(); | ||
|
||
const list = $('.main') | ||
.toArray() | ||
.slice(0, -1) // last item is a template | ||
.map((item) => { | ||
item = $(item); | ||
return { | ||
title: item.find('a').text(), | ||
author, | ||
link: `${baseUrl}${item.find('a').attr('href')}`, | ||
description: item.find('.preview').text(), | ||
}; | ||
}); | ||
|
||
const items = await Promise.all( | ||
list.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const response = await got(item.link, { | ||
headers: { | ||
Referer: url, | ||
}, | ||
}); | ||
const $ = cheerio.load(response.data); | ||
|
||
$('.js_img_placeholder').remove(); | ||
$('amp-img').each((_, e) => { | ||
e = $(e); | ||
e.replaceWith(`<img src="${new URL(e.attr('src'), response.url).href}" width="${e.attr('width')}" height="${e.attr('height')}" decoding="async">`); | ||
}); | ||
$('amp-video').each((_, e) => { | ||
e = $(e); | ||
e.replaceWith(`<video width="${e.attr('width')}" height="${e.attr('height')}" controls poster="${e.attr('poster')}">${e.html()}</video>`); | ||
}); | ||
|
||
item.description = fixArticleContent($('#js_content')); | ||
item.pubDate = timezone(parseDate($('#publish_time').text()), +8); | ||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: $('head title').text(), | ||
link: url, | ||
image: 'https://freewechat.com/favicon.ico', | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'freewechat.com': { | ||
_name: '自由微信', | ||
'.': [ | ||
{ | ||
title: '公众号', | ||
docs: 'https://docs.rsshub.app/new-media.html#zi-you-wei-xin', | ||
source: ['/profile/:id'], | ||
target: '/freewechat/profile/:id', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/profile/:id', require('./profile')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
'/jwc/:type': ['simonsmh'], | ||
'/jwc/:type': ['imbytecat', 'simonsmh'], | ||
'/portal/:type': ['imbytecat'], | ||
'/www/:type': ['simonsmh'], | ||
'/www/:type': ['imbytecat', 'simonsmh'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4927,10 +4927,10 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1068969.tgz#8b9a4bc48aed1453bed08d62b07481f9abf4d6d8" | ||
integrity sha512-ATFTrPbY1dKYhPPvpjtwWKSK2mIwGmRwX54UASn9THEuIZCe2n9k3vVuMmt6jWeL+e5QaaguEv/pMyR+JQB7VQ== | ||
|
||
[email protected].3: | ||
version "1.0.3" | ||
resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456" | ||
integrity sha512-K7i4zNfT2kgQz3GylDw40ot9GAE47sFZ9EXHFSPP6zONLgH6kWXE0KWJchkbQJLBkRazq4APwZ4OwiFFlT95OQ== | ||
dezalgo@^1.0.4: | ||
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.4.tgz#751235260469084c132157dfa857f386d4c33d81" | ||
integrity sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig== | ||
dependencies: | ||
asap "^2.0.0" | ||
wrappy "1" | ||
|
@@ -6310,15 +6310,15 @@ formidable@^1.2.0: | |
resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.2.6.tgz#d2a51d60162bbc9b4a055d8457a7c75315d1a168" | ||
integrity sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ== | ||
|
||
formidable@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/formidable/-/formidable-2.0.1.tgz#4310bc7965d185536f9565184dee74fbb75557ff" | ||
integrity sha512-rjTMNbp2BpfQShhFbR3Ruk3qk2y9jKpvMW78nJgx8QKtxjDVrwbZG+wvDOmVbifHyOUOQJXxqEy6r0faRrPzTQ== | ||
formidable@^2.1.1: | ||
version "2.1.1" | ||
resolved "https://registry.yarnpkg.com/formidable/-/formidable-2.1.1.tgz#81269cbea1a613240049f5f61a9d97731517414f" | ||
integrity sha512-0EcS9wCFEzLvfiks7omJ+SiYJAiD+TzK4Pcw1UlUoGnhUxDcMKjt0P7x8wEb0u6OHu8Nb98WG3nxtlF5C7bvUQ== | ||
dependencies: | ||
dezalgo "1.0.3" | ||
hexoid "1.0.0" | ||
once "1.4.0" | ||
qs "6.9.3" | ||
dezalgo "^1.0.4" | ||
hexoid "^1.0.0" | ||
once "^1.4.0" | ||
qs "^6.11.0" | ||
|
||
[email protected]: | ||
version "0.2.0" | ||
|
@@ -6982,7 +6982,7 @@ hex-color-regex@^1.1.0: | |
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" | ||
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== | ||
|
||
[email protected]: | ||
hexoid@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/hexoid/-/hexoid-1.0.0.tgz#ad10c6573fb907de23d9ec63a711267d9dc9bc18" | ||
integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g== | ||
|
@@ -10308,7 +10308,7 @@ on-headers@~1.0.2: | |
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" | ||
integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== | ||
|
||
once@1.4.0, once@^1.3.0, once@^1.3.1, once@^1.4.0: | ||
once@^1.3.0, once@^1.3.1, once@^1.4.0: | ||
version "1.4.0" | ||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" | ||
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== | ||
|
@@ -11497,11 +11497,6 @@ [email protected], qs@^6.11.0, qs@^6.5.1, qs@^6.7.0: | |
dependencies: | ||
side-channel "^1.0.4" | ||
|
||
[email protected]: | ||
version "6.9.3" | ||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.3.tgz#bfadcd296c2d549f1dffa560619132c977f5008e" | ||
integrity sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw== | ||
|
||
qs@~6.5.2: | ||
version "6.5.3" | ||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" | ||
|
@@ -13033,29 +13028,29 @@ superagent@^3.8.2: | |
qs "^6.5.1" | ||
readable-stream "^2.3.5" | ||
|
||
superagent@^8.0.3: | ||
version "8.0.3" | ||
resolved "https://registry.yarnpkg.com/superagent/-/superagent-8.0.3.tgz#15c8ec5611a1f01386994cfeeda5aa138bcb7b17" | ||
integrity sha512-oBC+aNsCjzzjmO5AOPBPFS+Z7HPzlx+DQr/aHwM08kI+R24gsDmAS1LMfza1fK+P+SKlTAoNZpOvooE/pRO1HA== | ||
superagent@^8.0.5: | ||
version "8.0.6" | ||
resolved "https://registry.yarnpkg.com/superagent/-/superagent-8.0.6.tgz#e3fb0b3112b79b12acd605c08846253197765bf6" | ||
integrity sha512-HqSe6DSIh3hEn6cJvCkaM1BLi466f1LHi4yubR0tpewlMpk4RUFFy35bKz8SsPBwYfIIJy5eclp+3tCYAuX0bw== | ||
dependencies: | ||
component-emitter "^1.3.0" | ||
cookiejar "^2.1.3" | ||
debug "^4.3.4" | ||
fast-safe-stringify "^2.1.1" | ||
form-data "^4.0.0" | ||
formidable "^2.0.1" | ||
formidable "^2.1.1" | ||
methods "^1.1.2" | ||
mime "2.6.0" | ||
qs "^6.11.0" | ||
semver "^7.3.8" | ||
|
||
[email protected].2: | ||
version "6.3.2" | ||
resolved "https://registry.yarnpkg.com/supertest/-/supertest-6.3.2.tgz#7780b4b85bb2ea675c05b5cb80fa52f4dbe5a52b" | ||
integrity sha512-mSmbW/sPpBU6K8w8189ZiHdc62zMe7dCHpC2ktS9tc0/d2DN0FaxNbDJJNFknZD4jCrGJpxkiFoVyemvKgOdwA== | ||
[email protected].3: | ||
version "6.3.3" | ||
resolved "https://registry.yarnpkg.com/supertest/-/supertest-6.3.3.tgz#42f4da199fee656106fd422c094cf6c9578141db" | ||
integrity sha512-EMCG6G8gDu5qEqRQ3JjjPs6+FYT1a7Hv5ApHvtSghmOFJYtsU5S+pSb6Y2EUeCEY3CmEL3mmQ8YWlPOzQomabA== | ||
dependencies: | ||
methods "^1.1.2" | ||
superagent "^8.0.3" | ||
superagent "^8.0.5" | ||
|
||
supports-color@^5.3.0, supports-color@^5.5.0: | ||
version "5.5.0" | ||
|
87413fa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rsshub-master – ./
rsshub-master-auto-bot-ty.vercel.app
rsshub-master.vercel.app
rsshub-master-git-master-auto-bot-ty.vercel.app