mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
25 lines
875 B
JavaScript
25 lines
875 B
JavaScript
const utils = require('./utils');
|
|
const config = require('@/config').value;
|
|
|
|
module.exports = async (ctx) => {
|
|
if (!config.twitter || !config.twitter.consumer_key || !config.twitter.consumer_secret) {
|
|
throw 'Twitter RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#%E9%83%A8%E5%88%86-rss-%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE">relevant config</a>';
|
|
}
|
|
const keyword = ctx.params.keyword;
|
|
const result = await utils.getTwit().get('search/tweets', {
|
|
q: keyword,
|
|
count: 50,
|
|
tweet_mode: 'extended',
|
|
result_type: 'recent',
|
|
});
|
|
const data = result.data;
|
|
|
|
ctx.state.data = {
|
|
title: `Twitter Keyword - ${keyword}`,
|
|
link: `https://twitter.com/search?q=${encodeURIComponent(keyword)}`,
|
|
item: utils.ProcessFeed({
|
|
data: data.statuses,
|
|
}),
|
|
};
|
|
};
|