feat: v3 migration - 3/n

This commit is contained in:
DIYgod
2024-02-28 16:33:13 +08:00
parent 185b5d1441
commit fdf3fcac57
611 changed files with 3540 additions and 3528 deletions
+4 -4
View File
@@ -1,8 +1,8 @@
const utils = require('../utils');
module.exports = async (ctx) => {
const keyword = ctx.params.keyword;
const limit = ctx.query.limit ?? 50;
const keyword = ctx.req.param('keyword');
const limit = ctx.req.query('limit') ?? 50;
const client = await utils.getAppClient();
const data = await client.v1.get('search/tweets.json', {
q: keyword,
@@ -11,12 +11,12 @@ module.exports = async (ctx) => {
result_type: 'recent',
});
ctx.state.data = {
ctx.set('data', {
title: `Twitter Keyword - ${keyword}`,
link: `https://twitter.com/search?q=${encodeURIComponent(keyword)}`,
item: utils.ProcessFeed(ctx, {
data: data.statuses,
}),
allowEmpty: true,
};
});
};
+4 -4
View File
@@ -1,9 +1,9 @@
const utils = require('../utils');
module.exports = async (ctx) => {
const id = ctx.params.id;
const id = ctx.req.param('id');
// For compatibility
const { exclude_replies, include_rts, count } = utils.parseRouteParams(ctx.params.routeParams);
const { exclude_replies, include_rts, count } = utils.parseRouteParams(ctx.req.param('routeParams'));
const client = await utils.getAppClient();
const user_timeline_query = {
tweet_mode: 'extended',
@@ -25,7 +25,7 @@ module.exports = async (ctx) => {
}
const profileImageUrl = userInfo.profile_image_url || userInfo.profile_image_url_https;
ctx.state.data = {
ctx.set('data', {
title: `Twitter @${userInfo.name}`,
link: `https://twitter.com/${screen_name}`,
image: profileImageUrl,
@@ -33,5 +33,5 @@ module.exports = async (ctx) => {
item: utils.ProcessFeed(ctx, {
data,
}),
};
});
};