Giter Site home page Giter Site logo

youtube_title_parse's Introduction

PyPI version shields.io PyPI license PyPI status youtube_title_parse CI

youtube title parse

Parse the title of a YouTube video to try and get artist & song name.

Description

Video titles on YouTube follow no strict format, and so passing the titles directly to music APIs to fetch metadata hardly works. This module attempts to recognize common patterns (using regex) and extract artist and song name.

Installation

To install youtube_title_parse, simply run:

pip install youtube_title_parse

Usage

CLI

youtube_title_parse comes with a CLI that you can use directly:

$ youtube_title_parse "Seoul - Stay With Us (Official Video)"
Seoul - Stay With Us

Module

You can also import youtube_title_parse as a module. If the module can successfully parse the input, get_artist_title will return a tuple of the format [artist, title] which you can use as below. If not found, [None, None] is returned.

from youtube_title_parse import get_artist_title

artist, title = get_artist_title("Seoul - Stay With Us (Official Video)")
assert artist == "Seoul"
assert title == "Stay With Us"

Credits

This module is originally a Python3 rewrite of the equivalent npm library, get-artist-title, but adds some extra functionality to catch more patterns.

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

License

youtube-title-parse is made available under the MIT license.

youtube_title_parse's People

Contributors

ghostwriternr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

youtube_title_parse's Issues

Make unit tests more readable

Unit tests currently look like:

{
    "input": "Boats & BIrds - Gregory & the Hawk",
    "expected": ["Boats & BIrds", "Gregory & the Hawk"],
}

but it not entirely clear what the expected array is. Considering changing it to:

{
    "input": "Boats & BIrds - Gregory & the Hawk",
    "expected": {
        "artist": "Boats & BIrds",
        "title": "Gregory & the Hawk"
    },
}

Might also be a good time to consider if the return type of the module is best suited as a tuple or dict.

Return tuple instead of string

Is it possible to have get_artist_title return a tuple (artist, title) instead of a string, like how get-artist-title works?

Right now I want to get the parsed artist and title individually, but right now it returns a combined string which I have to split on -.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.