各大音乐社区api接口(MP3&LRC)

给自己以后开发应用的时候可能用的着:

 

百度:
sound:
http://box.zhangmen.baidu.com/x?op=12&count=1&title=不得不爱$$潘玮柏$$$$
lrc:
http://box.zhangmen.baidu.com/bdlrc/86/8654.lrc
这个地址解析下: 
http://box.zhangmen.baidu.com/bdlrc/ 这个是百度lrc歌词存放地址,后面的496是一个的不定的,民就是说歌曲不同那个目录名也不同,它的算法是拿歌词文件名(也就是上面说的 8654) 除以一百,然后取小于等于其结果的最大整数,如上面的:8654/100 =86.54取小于等于86.54 的最大整数就是86,于是这首歌完整的歌词地址:http://box.zhangmen.baidu.com/bdlrc/86/8654.lrc

QQ音乐:
sound:
http://qqmusic.qq.com/fcgi-bin/qm_getLyricId.fcg?name=不得不爱&singer=潘玮柏&from=qqplayer
lrc:
http://music.qq.com/miniportal/static/lyric/90/95690.xml

 

说明:lrc的歌词地址 lyric/90/95690.xm 其中的90是上面sound中出来的id95690的最后面两位数字、。
 
搜搜音乐:
sound:
http://cgi.music.soso.com/fcgi-bin/m.q?w=不得不爱&p=1&t=0
格式: 1-全部 0-MP3 1-RM ,2-WMA
lrc:(注意!歌曲名和歌手名字一定要准确)
http://cgi.music.soso.com/fcgi-bin/fcg_download_lrc.q?song=不得不爱&singer=潘玮柏%26弦子&down=1

 
8BOX
sound:
http://api.8box.com/get/search/song?api_key={api_key}&title={歌曲名(URL16进制加密)}&artist={歌手(URL16进制加密)}
    
 lrc:(2010年8月19日更新)
http://www.8box.com/feed/radio/s?type=widget&param={歌曲ID(数字)}
http://www.8box.com/pictures/lyrics/83/591383.lrc

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
生成LRC文件需要对MP3文件进行解析,提取出歌词信息。Java中可以使用第三方库来实现这一功能,如`jAudiotagger`和`jlrc`。 下面是一个简单的示例代码,使用`jAudiotagger`库从MP3文件中提取出歌词信息并生成LRC文件: ```java import java.io.File; import java.io.FileWriter; import java.io.IOException; import org.jaudiotagger.audio.AudioFile; import org.jaudiotagger.audio.AudioFileIO; import org.jaudiotagger.tag.FieldKey; import org.jaudiotagger.tag.Tag; import org.jaudiotagger.tag.datatype.Lyrics3Line; import org.jaudiotagger.tag.id3.AbstractID3v2Frame; import org.jaudiotagger.tag.id3.ID3v24Tag; public class Mp3ToLrcConverter { public static void main(String[] args) throws Exception { File mp3File = new File("path/to/mp3/file.mp3"); File lrcFile = new File("path/to/lrc/file.lrc"); convertMp3ToLrc(mp3File, lrcFile); } public static void convertMp3ToLrc(File mp3File, File lrcFile) throws Exception { AudioFile audioFile = AudioFileIO.read(mp3File); Tag tag = audioFile.getTag(); // Check if the MP3 file has embedded lyrics if (tag != null) { String lyrics = tag.getFirst(FieldKey.LYRICS); if (lyrics != null && !lyrics.isEmpty()) { writeLrcFile(lrcFile, lyrics); return; } } // If the MP3 file doesn't have embedded lyrics, try to extract them from ID3v2 tags if (audioFile instanceof org.jaudiotagger.audio.mp3.MP3File) { org.jaudiotagger.audio.mp3.MP3File mp3 = (org.jaudiotagger.audio.mp3.MP3File) audioFile; ID3v24Tag id3v2Tag = mp3.getID3v2TagAsv24(); if (id3v2Tag != null) { AbstractID3v2Frame lyricsFrame = id3v2Tag.getFirst("USLT"); if (lyricsFrame != null) { String lyrics = lyricsFrame.getContent(); writeLrcFile(lrcFile, lyrics); return; } } } // If the MP3 file doesn't have embedded lyrics or ID3v2 tags, try to extract them from Lyrics3 tags if (audioFile.hasLyrics3Tag()) { Lyrics3Line lyrics3Line = audioFile.getLyrics3Tag().getLine(0); if (lyrics3Line != null) { String lyrics = lyrics3Line.getLyric(); writeLrcFile(lrcFile, lyrics); return; } } // If the MP3 file doesn't have any embedded lyrics, throw an exception throw new Exception("No lyrics found in the MP3 file."); } public static void writeLrcFile(File lrcFile, String lyrics) throws IOException { try (FileWriter writer = new FileWriter(lrcFile)) { writer.write(lyrics); } } } ``` 这段代码会首先检查MP3文件是否有内嵌歌词,如果有则直接生成LRC文件。如果没有内嵌歌词,则尝试从ID3v2标签或Lyrics3标签中提取歌词信息,最后将歌词信息写入LRC文件。如果无法提取歌词信息,则抛出异常。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值