Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Jul 25, 2024
1 parent d4b1422 commit 5488c48
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion YoutubeExplode.Tests/PlaylistSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task I_can_get_the_metadata_of_a_playlist()
playlist
.Description.Should()
.Contain("Digital Analytics Fundamentals course on Analytics Academy");
playlist.VideosCount.Should().Be(22);
playlist.Count.Should().Be(22);
playlist.Thumbnails.Should().NotBeEmpty();
}

Expand Down Expand Up @@ -83,6 +83,7 @@ public async Task I_can_get_the_metadata_of_any_available_playlist(string playli
playlist.Url.Should().NotBeNullOrWhiteSpace();
playlist.Title.Should().NotBeNullOrWhiteSpace();
playlist.Description.Should().NotBeNull();
playlist.Count.Should().NotBe(0);
playlist.Thumbnails.Should().NotBeEmpty();
}

Expand Down
2 changes: 1 addition & 1 deletion YoutubeExplode/Bridge/IPlaylistData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal interface IPlaylistData

string? Description { get; }

int? VideosCount { get; }
int? Count { get; }

IReadOnlyList<ThumbnailData> Thumbnails { get; }
}
2 changes: 1 addition & 1 deletion YoutubeExplode/Bridge/PlaylistBrowseResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ internal partial class PlaylistBrowseResponse(JsonElement content) : IPlaylistDa
?.GetStringOrNull();

[Lazy]
public int? VideosCount =>
public int? Count =>
SidebarPrimary
?.GetPropertyOrNull("stats")
?.EnumerateArrayOrNull()
Expand Down
2 changes: 1 addition & 1 deletion YoutubeExplode/Bridge/PlaylistNextResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal partial class PlaylistNextResponse(JsonElement content) : IPlaylistData
public string? Description => null;

[Lazy]
public int? VideosCount =>
public int? Count =>
ContentRoot
?.GetPropertyOrNull("totalVideosText")
?.GetPropertyOrNull("runs")
Expand Down
8 changes: 4 additions & 4 deletions YoutubeExplode/Playlists/Playlist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Playlist(
string title,
Author? author,
string description,
int? videosCount,
int? count,
IReadOnlyList<Thumbnail> thumbnails
) : IPlaylist
{
Expand All @@ -34,12 +34,12 @@ IReadOnlyList<Thumbnail> thumbnails
public string Description { get; } = description;

/// <summary>
/// Count of total videos.
/// Total count of videos included in the playlist.
/// </summary>
/// <remarks>
/// May be null in case of playlists with infinite videos (e.g. mixes).
/// May be null in case of infinite playlists (e.g. auto-generated mixes).
/// </remarks>
public int? VideosCount { get; } = videosCount;
public int? Count { get; } = count;

/// <inheritdoc />
public IReadOnlyList<Thumbnail> Thumbnails { get; } = thumbnails;
Expand Down
4 changes: 2 additions & 2 deletions YoutubeExplode/Playlists/PlaylistClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ channelId is not null && channelTitle is not null
// System playlists have no description
var description = response.Description ?? "";

var videosCount = response.VideosCount;
var count = response.Count;

var thumbnails = response
.Thumbnails.Select(t =>
Expand All @@ -65,7 +65,7 @@ channelId is not null && channelTitle is not null
})
.ToArray();

return new Playlist(playlistId, title, author, description, videosCount, thumbnails);
return new Playlist(playlistId, title, author, description, count, thumbnails);
}

/// <summary>
Expand Down

0 comments on commit 5488c48

Please sign in to comment.