fix
This commit is contained in:
parent
92aa9388fe
commit
e53beb1f9d
2 changed files with 24 additions and 14 deletions
|
@ -67,9 +67,10 @@ namespace BirdsiteLive.Domain
|
||||||
var content = extractedTags.content;
|
var content = extractedTags.content;
|
||||||
if (tweet.IsRetweet)
|
if (tweet.IsRetweet)
|
||||||
{
|
{
|
||||||
content = "RT: " + content;
|
// content = "RT: " + content;
|
||||||
cc = new[] {"https://www.w3.org/ns/activitystreams#Public"};
|
cc = new[] {"https://www.w3.org/ns/activitystreams#Public"};
|
||||||
}
|
}
|
||||||
|
cc = new[] {"https://www.w3.org/ns/activitystreams#Public"};
|
||||||
|
|
||||||
string inReplyTo = null;
|
string inReplyTo = null;
|
||||||
// if (tweet.InReplyToStatusId != default)
|
// if (tweet.InReplyToStatusId != default)
|
||||||
|
|
|
@ -167,26 +167,35 @@ namespace BirdsiteLive.Twitter
|
||||||
|
|
||||||
var extractedMedia = Array.Empty<ExtractedMedia>();
|
var extractedMedia = Array.Empty<ExtractedMedia>();
|
||||||
JsonElement attachments;
|
JsonElement attachments;
|
||||||
if (tweet.TryGetProperty("attachments", out attachments))
|
try
|
||||||
{
|
{
|
||||||
foreach (JsonElement m in attachments.GetProperty("media_keys").EnumerateArray())
|
if (tweet.TryGetProperty("attachments", out attachments))
|
||||||
{
|
{
|
||||||
var mediaInfo = media.EnumerateArray().Where(x => x.GetProperty("media_key").GetString() == m.GetString()).First();
|
foreach (JsonElement m in attachments.GetProperty("media_keys").EnumerateArray())
|
||||||
var mediaType = mediaInfo.GetProperty("type").GetString();
|
|
||||||
if (mediaType != "photo")
|
|
||||||
{
|
{
|
||||||
continue;
|
var mediaInfo = media.EnumerateArray().Where(x => x.GetProperty("media_key").GetString() == m.GetString()).First();
|
||||||
}
|
var mediaType = mediaInfo.GetProperty("type").GetString();
|
||||||
var url = mediaInfo.GetProperty("url").GetString();
|
if (mediaType != "photo")
|
||||||
extractedMedia.Append(
|
|
||||||
new ExtractedMedia
|
|
||||||
{
|
{
|
||||||
Url = url,
|
continue;
|
||||||
MediaType = GetMediaType(mediaType, url),
|
|
||||||
}
|
}
|
||||||
);
|
var url = mediaInfo.GetProperty("url").GetString();
|
||||||
|
extractedMedia.Append(
|
||||||
|
new ExtractedMedia
|
||||||
|
{
|
||||||
|
Url = url,
|
||||||
|
MediaType = GetMediaType(mediaType, url),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.LogError("Tried getting media from tweet, but got error:", e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue