mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-01 01:28:08 +08:00
* fix(route)(twitter): quote ignored in web API * refactor: migrate to v2 Signed-off-by: Rongrong <i@rong.moe>
18 lines
599 B
JavaScript
18 lines
599 B
JavaScript
const config = require('@/config').value;
|
|
const logger = require('@/utils/logger');
|
|
const utils = require('./utils');
|
|
|
|
module.exports = async (ctx, devApiImpl, webApiImpl) => {
|
|
const { force_web_api } = utils.parseRouteParams(ctx.params.routeParams);
|
|
|
|
if (!force_web_api && config.twitter && config.twitter.consumer_key && config.twitter.consumer_secret) {
|
|
try {
|
|
await devApiImpl(ctx);
|
|
return;
|
|
} catch (e) {
|
|
logger.error(`Fallback to Twitter web API due to developer API error:\n${e.stack}`);
|
|
}
|
|
}
|
|
await webApiImpl(ctx);
|
|
};
|