我有以下从 YouTube 链接获取的 Json 的 C# 代码,它有两个同名的属性,即作者、作者 2 和内部作者 - 名称、uri(我改为 Uris,因为它是一个关键字)在调用 url 时它返回所有内容但不是作者,它显示作者为空,帮我解决这个问题
这是我的源代码,
[DataContract]
public class Title
{
[DataMember (Name="$t")]
public string title { get; set; }
}
[DataContract]
public class Name2
{
[DataMember(Name = "$t")]
public string authorname { get; set; }
}
[DataContract]
public class Uri2
{
[DataMember(Name = "$t")]
public string channelurl { get; set; }
}
public class Author2
{
public Name2 name { get; set; }
public Uri2 uri { get; set; }
}
[DataContract]
public class YtChannelId
{
[DataMember (Name="$t")]
public string channelid { get; set; }
}
[DataContract]
public class MediaThumbnail
{
[DataMember(Name = "url")]
public string imgurl { get; set; }
}
[DataContract]
public class MediaGroup
{
[DataMember (Name="media$thumbnail")]
public List<MediaThumbnail> media_thumbnail { get; set; }
}
[DataContract]
public class FeAEntry
{
public List<Author2> author { get; set; }
[DataMember (Name="yt$channelId")]
public YtChannelId channelId { get; set; }
public Title title { get; set; }
[DataMember (Name="media$group")]
public MediaGroup media_group { get; set; }
}
public class FeAFeed
{
public List<FeAEntry> entry { get; set; }
}
public class Name
{
[DataMember (Name="$t")]
public string t { get; set; }
}
public class Uris
{
[DataMember (Name="$t")]
public string t { get; set; }
}
public class Author
{
public Name name { get; set; }
public Uris uri { get; set; }
}
public class FeARootObject
{
public FeAFeed feed { get; set; }
public List<Author> author { get; set; }
}
问候,
湿婆