Skip to content

Commit

Permalink
Fix date parsing (#35)
Browse files Browse the repository at this point in the history
* Fix date parsing on non-english systems
* Bump version
  • Loading branch information
kuylar authored Oct 13, 2023
1 parent 9235829 commit 6599873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions InnerTube/InnerTube.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<PackageLicenseUrl>https://github.com/kuylar/InnerTube/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/kuylar/InnerTube</RepositoryUrl>
<PackageTags>youtube, innertube</PackageTags>
<AssemblyVersion>1.0.25</AssemblyVersion>
<Version>1.0.25</Version>
<AssemblyVersion>1.0.26</AssemblyVersion>
<Version>1.0.26</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Remove/comment this while looking for missing XMLDocs -->
<NoWarn>$(NoWarn);1591</NoWarn>
Expand Down
7 changes: 4 additions & 3 deletions InnerTube/Models/InnerTubePlayer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using System.Globalization;
using Newtonsoft.Json.Linq;

namespace InnerTube;

Expand Down Expand Up @@ -28,8 +29,8 @@ public InnerTubePlayer(JObject playerResponse, JObject metadataResponse)
Keywords = metadataResponse.GetFromJsonPath<string[]>("videoDetails.keywords")!,
ShortDescription = metadataResponse.GetFromJsonPath<string>("videoDetails.shortDescription")!,
Category = metadataResponse.GetFromJsonPath<string>("videoDetails.category")!,
UploadDate = DateTimeOffset.Parse(metadataResponse.GetFromJsonPath<string>("microformat.playerMicroformatRenderer.uploadDate")!),
PublishDate = DateTimeOffset.Parse(metadataResponse.GetFromJsonPath<string>("microformat.playerMicroformatRenderer.publishDate")!),
UploadDate = DateTimeOffset.Parse(metadataResponse.GetFromJsonPath<string>("microformat.playerMicroformatRenderer.uploadDate")!, CultureInfo.InvariantCulture),
PublishDate = DateTimeOffset.Parse(metadataResponse.GetFromJsonPath<string>("microformat.playerMicroformatRenderer.publishDate")!, CultureInfo.InvariantCulture),
Length = TimeSpan.FromSeconds(
long.Parse(metadataResponse.GetFromJsonPath<string>("videoDetails.lengthSeconds")!)),
IsLive = metadataResponse.GetFromJsonPath<bool>("videoDetails.isLiveContent")!,
Expand Down

0 comments on commit 6599873

Please sign in to comment.