mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 21:18:57 +08:00
* fix(route)(twitter): quote ignored in web API * refactor: migrate to v2 Signed-off-by: Rongrong <i@rong.moe>
24 lines
825 B
JavaScript
24 lines
825 B
JavaScript
const utils = require('../utils');
|
|
// const config = require('@/config').value;
|
|
const { getUser, getUserMedia } = require('./twitter-api');
|
|
|
|
module.exports = async (ctx) => {
|
|
const id = ctx.params.id;
|
|
const { count } = utils.parseRouteParams(ctx.params.routeParams);
|
|
const params = count ? { count } : {};
|
|
|
|
const userInfo = await getUser(ctx.cache, id);
|
|
const data = await getUserMedia(ctx.cache, id, params);
|
|
const profileImageUrl = userInfo.profile_image_url || userInfo.profile_image_url_https;
|
|
|
|
ctx.state.data = {
|
|
title: `Twitter @${userInfo.name}`,
|
|
link: `https://twitter.com/${id}/media`,
|
|
image: profileImageUrl.replace(/_normal.jpg$/, '.jpg'),
|
|
description: userInfo.description,
|
|
item: utils.ProcessFeed(ctx, {
|
|
data,
|
|
}),
|
|
};
|
|
};
|