Skip to main content

LyricsMaster 是一个用于从多个歌词提供商处下载歌词的库。LyricWiki、AzLyrics、Genius、Lyric007、MusixMatch 和其他歌词提供商可用

项目描述

歌词大师

PyPi 状态 Linux 持续集成状态 Windows 持续集成状态 文件状态 依赖更新状态 覆盖状态

LyricsMaster 是一个用于从多个歌词提供商处下载歌词的库。

支持以下歌词提供程序:

  • 歌词维基

  • AzLyrics

  • 天才

  • 歌词007

  • MusixMatch

  • The Original Hip-Hop (Rap) 歌词存档 - OHHLA.com

  • 还有更多即将推出。

  • 免费软件:麻省理工学院许可证

  • 文档:https ://lyricsmaster.readthedocs.io 。

特征

  • 从 LyricWiki、AzLyrics、Genius、Lyric007、MusixMatch、OHHLA 等下载歌词。

  • 异步下载歌词。

  • 可以通过 Tor 请求匿名下载歌曲。

  • 轻松将歌词保存在您的计算机上。

用法

要在项目中使用 LyricsMaster:

from lyricsmaster import LyricWiki, TorController


# Select a provider from the supported Lyrics Providers (LyricWiki, AzLyrics, Genius etc..)
# The default Provider is LyricWiki
provider = LyricWiki()

# Fetch all lyrics from 2Pac
discography = provider.get_lyrics('2Pac')

# Discography Objects and Album Objects can be iterated over.
for album in discography:    # album is an Album Object.
    print('Album: ', album.title)
    for song in album:       # song is a Song Object.
        print('Song: ', song.title)
        print('Lyrics: ', song.lyrics)

# New indexing and slicing support of Discography and Album Objects
first_song_of_first_album = discography.albums[0].songs[0]
lat_two_songs_of_first_album = discography.albums[0].songs[-2:]

# Fetch all lyrics from 2pac's album 'All eyez on me'.
album = provider.get_lyrics('2Pac', album='All eyes on me')

# Fetch the lyrics from the song 'California Love' in 2pac's album 'All eyez on me'.
song = provider.get_lyrics('2Pac', album='All eyez on me', song='California Love)

# Once the lyrics are fetched, you can save them on disk.
# The 'save()' method is implemented for Discography, Album and Song objects.
# By default, the lyrics are saved in {user}/Documents/lyricsmaster/
discography.save()

# You can also supply a folder to save the lyrics in.
folder = 'c:\MyFolder'
discography.save(folder)

# For anonymity, you can use a Tor Proxy to make requests.
# The TorController class has the same defaults as a default Tor Install.
provider = LyricWiki(TorController())
discography = provider.get_lyrics('2Pac')

# For enhanced anonymity, the TorController can renew the the Tor ciruit for each album dowloaded.
# For this functionnality to work, the Tor ControlPort option must be enabled in your torrc config file.
# See https://www.torproject.org/docs/tor-manual.html.en for more information.
provider = LyricWiki(TorController(control_port=9051, password='password))
discography = provider.get_lyrics('2Pac')

要从命令行使用 LyricsMaster(默认的 Lyrics Provider 是 LyricWiki):

$ lyricsmaster <artist_name> options

例子:

$ lyricsmaster "2Pac"
Anonymous requests disabled. The connexion will not be anonymous.
Downloading 2Pacalypse Now (1991)
2Pacalypse Now (1991) succesfully downloaded
Downloading Strictly 4 My N.I.G.G.A.Z... (1993)
Strictly 4 My N.I.G.G.A.Z... (1993) succesfully downloaded
Downloading Thug Life - Volume 1 (1994)
...


$ lyricsmaster "2Pac" --provider Genius
Anonymous requests disabled. The connexion will not be anonymous.
Downloading The Rose That Grew From Concrete (Book)
The Rose That Grew From Concrete (Book) succesfully downloaded
Downloading Best of 2Pac Part 2: Life
Best of 2Pac Part 2: Life succesfully downloaded
...


$ lyricsmaster "2Pac" --tor 127.0.0.1
Anonymous requests enabled. The Tor circuit will change according to the Tor network defaults.
Downloading 2Pacalypse Now (1991)
2Pacalypse Now (1991) succesfully downloaded
Downloading Strictly 4 My N.I.G.G.A.Z... (1993)
Strictly 4 My N.I.G.G.A.Z... (1993) succesfully downloaded
Downloading Thug Life - Volume 1 (1994)
...


$ lyricsmaster "2Pac" --tor 127.0.0.1 --controlport 9051 --password password
Anonymous requests enabled. The Tor circuit will change for each album.
New Tor circuit created
Downloading 2Pacalypse Now (1991)
2Pacalypse Now (1991) succesfully downloaded
New Tor circuit created
Downloading Strictly 4 My N.I.G.G.A.Z... (1993)
Strictly 4 My N.I.G.G.A.Z... (1993) succesfully downloaded
New Tor circuit created
Downloading Thug Life - Volume 1 (1994)
...

历史

2.8.1 (2019-04-07)

  • 为 Discography 和 Album 类更全面地实现了 Python 数据模型。

  • 现在,Discography 对象中的单个专辑或歌曲可以通过在以前可迭代的基础上进行索引或切片来单独访问。

  • 例如 Discography.albums[0].songs[0] 或 Discography.albums[0].songs[2:5]

  • 更新了依赖项。

2.8 (2019-03-31)

2.7.25 (2019-03-23)

  • 即使 html 编码有错误信息,也增强了对 utf-8 字符的支持。(见https://github.com/SekouD/lyricsmaster/issues/211

  • 修复了 MusixMatch 仅解析部分歌词的第一句时的错误。

  • 更新了记录器配置,以避免在将歌词大师用作库而不是独立时重复记录。

  • 更新了依赖项。

2.7.24 (2019-03-16)

2.7.23 (2019-02-28)

  • 更新了 Lyricsmaster 以反映 MusixMatch 和 Lyrics007 API 的变化。

  • 更新了依赖项。

2.7.22 (2018-11-18)

  • 更新了依赖项。

2.7.21 (2018-11-04)

  • 更新到最新的 tor 版本。

  • 更新了依赖项。

2.7.20 (2018-07-29)

  • 更新到最新的 tor 版本。

  • 更新了文档。

2.7.19 (2018-07-16)

  • 当专辑的发布日期不在所有提供商的标题标签中时,捕获异常。

2.7.17 (2018-07-08)

  • 改进的测试。

  • 更新了文档。

2.7.16 (2017-09-27)

  • 一般改进。

2.7.0 (2017-09-27)

  • 添加了命令行界面。

2.6.0 (2017-09-26)

  • 添加了天才提供者。

2.5.0 (2017-09-26)

  • 添加了 python 2.7 兼容性

2.4.0 (2017-09-24)

  • 添加了 AzLyrics 提供程序。

2.3.0 (2017-09-21)

  • 添加了完整的文档。

  • 更正了更新 Tor 电路时的异步请求错误。

2.2.0 (2017-09-20)

  • 为唱片、专辑、歌曲对象添加了保存方法。

2.1.0 (2017-09-20)

  • 添加了异步请求。

2.0.0 (2017-09-19)

  • 添加了 Tor 匿名化。

1.0.0 (2017-09-17)

  • 添加了 LyricWiki 提供程序。

0.1.0 (2017-09-11)

  • PyPI 上的第一个版本。

项目详情