Files
RSSHub/lib/v2/twitter/likes.js
Rongrong df5d3fc918 fix(route)(twitter): quote ignored in web API (#10361)
* fix(route)(twitter): quote ignored in web API

* refactor: migrate to v2

Signed-off-by: Rongrong <i@rong.moe>
2022-08-01 20:25:32 +08:00

23 lines
765 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/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>';
}
const id = ctx.params.id;
const client = await utils.getAppClient();
const data = await client.v1.get('favorites/list.json', {
screen_name: id,
tweet_mode: 'extended',
});
ctx.state.data = {
title: `Twitter Likes - ${id}`,
link: `https://twitter.com/${id}/likes`,
item: utils.ProcessFeed(ctx, {
data,
}),
};
};