Skip to content

Commit

Permalink
fix(route): lofter img src (DIYgod#11065)
Browse files Browse the repository at this point in the history
* fix(route): lofter img src

* fix: regex
  • Loading branch information
TonyRL authored Oct 11, 2022
1 parent 6a1d5ad commit 7ab4596
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/v2/lofter/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ module.exports = async (ctx) => {
link: item.post.blogPageUrl,
description:
JSON.parse(item.post.photoLinks || `[]`)
.map((photo) => `<img src="${photo.raw}">`)
.map((photo) => {
if (photo.raw.match(/\/\/nos\.netease\.com\//)) {
photo.raw = `https://${photo.raw.match(/(imglf\d)/)[0]}.lf127.net${photo.raw.match(/\/\/nos\.netease\.com\/imglf\d(.*)/)[1]}`;
}
return `<img src="${photo.raw}">`;
})
.join('') +
JSON.parse(item.post.embed ? `[${item.post.embed}]` : `[]`)
.map((video) => `<video src="${video.originUrl}" poster="${video.video_img_url}" controls="controls"></video>`)
Expand Down

0 comments on commit 7ab4596

Please sign in to comment.