LyricsMaster是一个从多个歌词提供商下载歌词的库。提供LyricWiki、Az歌词、Genius、Lyrics007、MusixMatch和其他歌词提供商
lyricsmaster的Python项目详细描述
歌词母版
LyricsMaster是一个从多个歌词提供商下载歌词的库。
支持以下歌词提供程序:
- 抒情维基
- Az歌词
- 天才
- 歌词007
- 音乐匹配
- 原嘻哈(RAP)歌词档案-ohhla.com
- 不久还会有更多。
- 自由软件:麻省理工学院许可证
- 文档:https://lyricsmaster.readthedocs.io。
功能
- 从LyricWiki、Az歌词、Genius、Lyrics007、MusixMatch、Ohla等网站下载歌词。
- 异步下载歌词。
- 可以通过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(默认歌词提供程序是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数据模型。 现在,在一个DeC形像对象中单独的相册或歌曲可以通过在先前迭代的顶部进行索引或切片来单独访问。
- 例如discography.albums[0].songs[0]或discography.albums[0].songs[2:5]
- 更新的依赖项。
2.8(2019-03-31)
- 增强了对utf-8字符的支持,即使html编码有错误的信息。(见https://github.com/SekouD/lyricsmaster/issues/211)
- 修正了Az歌词错误时,艺术家有歌曲,但没有专辑的服务。
- 更新的依赖项。
2.7.25(2019-03-23)
- 增强了对utf-8字符的支持,即使html编码有错误的信息。(见https://github.com/SekouD/lyricsmaster/issues/211)
- 修正了musixmatch错误,当只有一些歌词的第一句话被解析时。
- 当LyricsMaster用作库而不是独立库时,更新了记录器配置以避免重复日志。
- 更新的依赖项。
2.7.24(2019-03-16)
- 修复了从包含Unicode字符的URL下载歌词时出现的错误。(见https://github.com/SekouD/lyricsmaster/issues/211)
- 将print()的使用替换为python日志记录工具。
- 更新的依赖项。
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)
- 添加了Genius提供程序。
2.5.0(2017-09-26)
- 增加了Python2.7兼容性
2.4.0(2017-09-24)
- 添加了Az歌词提供程序。
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)
- 增加了匿名性。
1.0.0(2017-09-17)
- 添加了LyricWiki提供程序。
0.1.0(2017-09-11)
- pypi上的第一个版本。