extract only needed info from tweets

This commit is contained in:
Nicolas Constant
2020-07-22 20:19:40 -04:00
parent 1724d3a902
commit fffc9af534
7 changed files with 140 additions and 69 deletions

View File

@@ -1,4 +1,5 @@
using BirdsiteLive.DAL.Models;
using BirdsiteLive.Twitter.Models;
using Tweetinvi.Models;
namespace BirdsiteLive.Pipeline.Models
@@ -6,7 +7,7 @@ namespace BirdsiteLive.Pipeline.Models
public class UserWithTweetsToSync
{
public SyncTwitterUser User { get; set; }
public ITweet[] Tweets { get; set; }
public ExtractedTweet[] Tweets { get; set; }
public Follower[] Followers { get; set; }
}
}

View File

@@ -7,6 +7,7 @@ using BirdsiteLive.DAL.Models;
using BirdsiteLive.Pipeline.Contracts;
using BirdsiteLive.Pipeline.Models;
using BirdsiteLive.Twitter;
using BirdsiteLive.Twitter.Models;
using Tweetinvi.Models;
namespace BirdsiteLive.Pipeline.Processors
@@ -51,9 +52,9 @@ namespace BirdsiteLive.Pipeline.Processors
return usersWtTweets.ToArray();
}
private ITweet[] RetrieveNewTweets(SyncTwitterUser user)
private ExtractedTweet[] RetrieveNewTweets(SyncTwitterUser user)
{
ITweet[] tweets;
ExtractedTweet[] tweets;
if (user.LastTweetPostedId == -1)
tweets = _twitterService.GetTimeline(user.Acct, 1);
else

View File

@@ -10,6 +10,7 @@ using BirdsiteLive.Domain;
using BirdsiteLive.Pipeline.Contracts;
using BirdsiteLive.Pipeline.Models;
using BirdsiteLive.Twitter;
using BirdsiteLive.Twitter.Models;
using Tweetinvi.Models;
namespace BirdsiteLive.Pipeline.Processors
@@ -50,7 +51,7 @@ namespace BirdsiteLive.Pipeline.Processors
return userWithTweetsToSync;
}
private async Task ProcessFollowerAsync(IEnumerable<ITweet> tweets, Follower follower, int userId,
private async Task ProcessFollowerAsync(IEnumerable<ExtractedTweet> tweets, Follower follower, int userId,
SyncTwitterUser user)
{
var fromStatusId = follower.FollowingsSyncStatus[userId];