Skip to content

Commit

Permalink
Add fallback for parsing video likes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Nov 29, 2023
1 parent 1100e1c commit b5ddca3
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions YoutubeExplode/Bridge/VideoWatchPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,25 @@ internal partial class VideoWatchPage
.Match(
s,
"""
"label"\s*:\s*"([\d,\.]+) likes"
"\s*:\s*"([\d,\.]+) likes"
"""
)
.Groups[1]
.Value
)
.NullIfWhiteSpace()
?.StripNonDigit()
.ParseLongOrNull()
?? _content
.Source
.Text
.Pipe(
s =>
Regex
.Match(
s,
"""
along with ([\d,\.]+) other people"
"""
)
.Groups[1]
Expand All @@ -62,7 +80,7 @@ internal partial class VideoWatchPage
.Match(
s,
"""
"label"\s*:\s*"([\d,\.]+) dislikes"
"\s*:\s*"([\d,\.]+) dislikes"
"""
)
.Groups[1]
Expand Down

0 comments on commit b5ddca3

Please sign in to comment.