mirror of
https://github.com/NicolasConstant/BirdsiteLive
synced 2025-06-05 21:49:16 +02:00
expand URL, fix #31
This commit is contained in:
@@ -45,6 +45,10 @@ namespace BirdsiteLive.Twitter.Extractors
|
|||||||
message = message.Replace("RT", "[RT]");
|
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;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,11 +43,16 @@ namespace BirdsiteLive.Twitter
|
|||||||
_statisticsHandler.CalledUserApi();
|
_statisticsHandler.CalledUserApi();
|
||||||
if (user == null) return null;
|
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
|
return new TwitterUser
|
||||||
{
|
{
|
||||||
Acct = username,
|
Acct = username,
|
||||||
Name = user.Name,
|
Name = user.Name,
|
||||||
Description = user.Description,
|
Description = description,
|
||||||
Url = $"https://twitter.com/{username}",
|
Url = $"https://twitter.com/{username}",
|
||||||
ProfileImageUrl = user.ProfileImageUrlFullSize,
|
ProfileImageUrl = user.ProfileImageUrlFullSize,
|
||||||
ProfileBackgroundImageUrl = user.ProfileBackgroundImageUrlHttps,
|
ProfileBackgroundImageUrl = user.ProfileBackgroundImageUrlHttps,
|
||||||
|
Reference in New Issue
Block a user