Skip to content

Commit

Permalink
fix publisheddate and uploadeddate parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
UnidentifiedX committed Aug 19, 2024
1 parent 90ab656 commit c3de460
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/YTSearch.NET.TestConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ static async Task Main(string[] args)
{
var client = new YouTubeSearchClient();

var a = await client.SearchYouTubeChannelAsync("rick astley");
//var a = await client.SearchYouTubeChannelAsync("rick astley");
var a = await client.GetVideoMetadataAsync("qUeud6DvOWI");

Debugger.Break();

Expand Down
4 changes: 2 additions & 2 deletions src/YTSearch.NET/YouTubeSearchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public async Task<YouTubeVideoQueryResult> GetVideoMetadataAsync(Uri uri)
var isRatingEnabled = (bool?)videoDetail?["allowRatings"];
var isPrivate = (bool?)videoDetail?["isPrivate"];
var isLiveContent = (bool?)videoDetail?["isLiveContent"];
var publishedDate = DateTime.ParseExact((string?)microFormatRenderer?["publishDate"], "yyyy-MM-dd", CultureInfo.InvariantCulture);
var uploadedDate = DateTime.ParseExact((string?)microFormatRenderer?["uploadDate"], "yyyy-MM-dd", CultureInfo.InvariantCulture);
var publishedDate = DateTime.Parse((string?)microFormatRenderer?["publishDate"]);
var uploadedDate = DateTime.Parse((string?)microFormatRenderer?["uploadDate"]);
var isFamilyFriendly = (bool?)microFormatRenderer?["isFamilySafe"];
var availableCountries = microFormatRenderer?["availableCountries"].Deserialize<string[]>();
var isUnlisted = (bool?)microFormatRenderer?["isUnlisted"];
Expand Down

0 comments on commit c3de460

Please sign in to comment.