expand URL, fix #31
This commit is contained in:
parent
f7baa86d45
commit
1d584b0df3
2 changed files with 10 additions and 1 deletions
|
@ -45,6 +45,10 @@ namespace BirdsiteLive.Twitter.Extractors
|
|||
message = message.Replace("RT", "[RT]");
|
||||
}
|
||||
|
||||
// Expand URLs
|
||||
foreach (var url in tweet.Urls.OrderByDescending(x => x.URL.Length))
|
||||
message = message.Replace(url.URL, url.ExpandedURL);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,11 +43,16 @@ namespace BirdsiteLive.Twitter
|
|||
_statisticsHandler.CalledUserApi();
|
||||
if (user == null) return null;
|
||||
|
||||
// Expand URLs
|
||||
var description = user.Description;
|
||||
foreach (var descriptionUrl in user.Entities?.Description?.Urls?.OrderByDescending(x => x.URL.Length))
|
||||
description = description.Replace(descriptionUrl.URL, descriptionUrl.ExpandedURL);
|
||||
|
||||
return new TwitterUser
|
||||
{
|
||||
Acct = username,
|
||||
Name = user.Name,
|
||||
Description = user.Description,
|
||||
Description = description,
|
||||
Url = $"https://twitter.com/{username}",
|
||||
ProfileImageUrl = user.ProfileImageUrlFullSize,
|
||||
ProfileBackgroundImageUrl = user.ProfileBackgroundImageUrlHttps,
|
||||
|
|
Reference in a new issue