YouTubeTitleParse 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package YouTubeTitleParse --version 1.0.0                
NuGet\Install-Package YouTubeTitleParse -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YouTubeTitleParse" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YouTubeTitleParse --version 1.0.0                
#r "nuget: YouTubeTitleParse, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install YouTubeTitleParse as a Cake Addin
#addin nuget:?package=YouTubeTitleParse&version=1.0.0

// Install YouTubeTitleParse as a Cake Tool
#tool nuget:?package=YouTubeTitleParse&version=1.0.0                

YouTubeTitleParse

Parse song & artist names from YouTube video titles

Description

It parses the artist and the song title based on YouTube titles. This library does not make any calls to any API, it tries to recognize based on the most common patters.

Requirements

CLI Usage

Download the latest version of YouTubeTitleParser and run the command

dotnet YouTubeTitleParse-CLI

Library

  1. Add the nuget to your project or download the .dll from the latest release
  2. Import the library using YouTubeTitleParse;
  3. The library works as a String extension so you can just call the function GetArtistTitle() on your variable like so
"ARTIST - Song (Official Video)".GetArtistTitle();

NOTE: If it's not possible to split into Artist and Title it will default to title only and the artist will be null

Options

It's possible to remove the functions running or even add your own

There are two types of functions for the processor, splitters and cleaners

  • The cleaner function has the following header string Foo(string videoTitle)
  • The splitter function has the following header string[] Foo(string videoTitle)

For the splitter the first item of the array is the artist and the second item is the song title

How to use Options

In this Example we will add a custom cleaner, and remove the FileExtension cleaner and keep the same splitters

using YouTubeTitleParse.Plguins;
using YouTubeTitleParse;

public string MyCleanerFunc(string title) {
    // [...]
}


var options = new Options() {
    Before = new List<Func<string, string>> { Base.CleanFluff, MyCleanerFunc },
    After = new Options.AfterCleanup {
        TitleCleaner  = new List<Func<string, string>> { Base.CleanTitle, QuotedTitle.Clean, Common.CleanCommonFluff },
        ArtistCleaner = new List<Func<string, string>> { Base.CleanArtist, QuotedTitle.Clean, MyCleanerFunc }
    }
};

"ARTIST - Song (Official Video)".GetArtistTitle(options);

Credits

This is a rewrite for C# of the Python3 youtube-title-parse

Contributing

Feel free to create pull requests, open issues specially if you have a new regex to parse more titles.

Note that each Regex has the comment identifying what it does to avoid having multiple regex doing the same.

License

YouTubeTitleParser is made available under MIT License

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 172 12/5/2023
1.0.0 140 9/28/2023