make user retrieval more resilient
This commit is contained in:
parent
739f7aaead
commit
1d5df9a83b
2 changed files with 9 additions and 5 deletions
|
@ -59,13 +59,13 @@ namespace BirdsiteLive.Twitter
|
|||
public ExtractedTweet[] GetTimeline(string username, int nberTweets, long fromTweetId = -1)
|
||||
{
|
||||
TweetinviConfig.CurrentThreadSettings.TweetMode = TweetMode.Extended;
|
||||
|
||||
var user = _twitterUserService.GetUser(username);
|
||||
if (user.Protected) return new ExtractedTweet[0];
|
||||
|
||||
|
||||
var tweets = new List<ITweet>();
|
||||
try
|
||||
{
|
||||
var user = _twitterUserService.GetUser(username);
|
||||
if (user == null || user.Protected) return new ExtractedTweet[0];
|
||||
|
||||
if (fromTweetId == -1)
|
||||
{
|
||||
var timeline = Timeline.GetUserTimeline(user.Id, nberTweets);
|
||||
|
|
|
@ -38,7 +38,11 @@ namespace BirdsiteLive.Twitter
|
|||
{
|
||||
user = User.GetUserFromScreenName(username);
|
||||
_statisticsHandler.CalledUserApi();
|
||||
if (user == null) return null;
|
||||
if (user == null)
|
||||
{
|
||||
_logger.LogWarning("User {username} not found", username);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Reference in a new issue