feat(route): tiktok iframe (#13066)
This commit is contained in:
parent
507e836238
commit
25e4d85853
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/user/:user', require('./user'));
|
||||
router.get('/user/:user/:iframe?', require('./user'));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
{{ if useIframe }}
|
||||
<iframe src="https://www.tiktok.com/embed/{{ id }}" height="757" frameborder="0" referrerpolicy="no-referrer"></iframe>
|
||||
{{ else }}
|
||||
<video controls loop poster="{{ poster }}" preload="none">
|
||||
<source src="{{ source }}">
|
||||
<source src="{{ source }}">
|
||||
</video>
|
||||
{{ /if }}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@ const config = require('@/config').value;
|
|||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
const { queryToBoolean } = require('@/utils/readable-social');
|
||||
|
||||
const baseUrl = 'https://www.tiktok.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { user } = ctx.params;
|
||||
const { user, iframe } = ctx.params;
|
||||
const useIframe = queryToBoolean(iframe);
|
||||
|
||||
const data = await ctx.cache.tryGet(
|
||||
`tiktok:user:${user}`,
|
||||
|
|
@ -38,6 +40,8 @@ module.exports = async (ctx) => {
|
|||
description: art(path.join(__dirname, 'templates/user.art'), {
|
||||
poster: item.video.cover,
|
||||
source: item.video.playAddr,
|
||||
useIframe,
|
||||
id: item.id,
|
||||
}),
|
||||
author: item.nickname,
|
||||
pubDate: parseDate(item.createTime, 'X'),
|
||||
|
|
|
|||
|
|
@ -467,13 +467,14 @@ Specify different option values than default values to improve readability. The
|
|||
```
|
||||
https://rsshub.app/threads/zuck/showAuthorInTitle=1&showAuthorInDesc=1&showQuotedAuthorAvatarInDesc=1&showAuthorAvatarInDesc=1&showEmojiForQuotesAndReply=1&showQuotedInTitle=1
|
||||
```
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## TikTok
|
||||
|
||||
### User
|
||||
|
||||
<RouteEn author="TonyRL" example="/tiktok/user/@linustech" path="/tiktok/user/:user" paramsDesc={['User ID, including @']} anticrawler="1" puppeteer="1" radar="1" rssbud="1"/>
|
||||
<RouteEn author="TonyRL" example="/tiktok/user/@linustech/true" path="/tiktok/user/:user/:iframe?" paramsDesc={['User ID, including @', 'Use the official iframe to embed the video, which allows you to view the video if the default option does not work. Default to `false`']} anticrawler="1" puppeteer="1" radar="1" rssbud="1"/>
|
||||
|
||||
## Twitter
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue