feat: v3 migration - 3/n
This commit is contained in:
@@ -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,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user