mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 07:40:26 +08:00
fix: error when no twitter consumer_key
This commit is contained in:
@@ -110,28 +110,31 @@ const ProcessFeed = ({ data = [] }, showAuthor = false) => {
|
||||
});
|
||||
};
|
||||
|
||||
const consumer_keys = config.twitter.consumer_key.split(',');
|
||||
const consumer_secrets = config.twitter.consumer_secret.split(',');
|
||||
const T = {};
|
||||
let count = 0;
|
||||
let index = -1;
|
||||
let getTwit = () => null;
|
||||
if (config.twitter.consumer_key && config.twitter.consumer_secret) {
|
||||
const consumer_keys = config.twitter.consumer_key.split(',');
|
||||
const consumer_secrets = config.twitter.consumer_secret.split(',');
|
||||
const T = {};
|
||||
let count = 0;
|
||||
let index = -1;
|
||||
|
||||
consumer_keys.forEach((consumer_key, index) => {
|
||||
const consumer_secret = consumer_secrets[index];
|
||||
if (consumer_key && consumer_secret) {
|
||||
T[index] = new Twit({
|
||||
consumer_key,
|
||||
consumer_secret,
|
||||
app_only_auth: true,
|
||||
});
|
||||
count = index + 1;
|
||||
}
|
||||
});
|
||||
consumer_keys.forEach((consumer_key, index) => {
|
||||
const consumer_secret = consumer_secrets[index];
|
||||
if (consumer_key && consumer_secret) {
|
||||
T[index] = new Twit({
|
||||
consumer_key,
|
||||
consumer_secret,
|
||||
app_only_auth: true,
|
||||
});
|
||||
count = index + 1;
|
||||
}
|
||||
});
|
||||
|
||||
const getTwit = () => {
|
||||
index++;
|
||||
return T[index % count];
|
||||
};
|
||||
getTwit = () => {
|
||||
index++;
|
||||
return T[index % count];
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ProcessFeed,
|
||||
|
||||
Reference in New Issue
Block a user