Az歌词的API包装器,允许您以编程方式提取数据

azlyrics的Python项目详细描述


一个api包装器,用于以编程方式从az歌词.com中提取数据

安装

您可以通过pip

轻松安装
pip install azlyrics

或者,也可以使用easy_install

easy_install azlyrics

用法

首先,需要从^{tt3}导入方法$ 模块;

from azlyrics import artists, songs, artists

然后您就可以这样使用这些方法;

artists(letter)
songs(artist)
lyrics(song, artist)

艺术家

Artists方法将返回与一封信相关联的所有Artists。 例如-https://www.azlyrics.com/o.html

printartists("o")
The above method will return the following:
["Oakenfold, Paul","Oak Ridge Boys, The","O.A.R. (Of A Revolution)","Oasis","Obel, Agnes","Oberst, Conor","Obie Trice","OB O'Brien","O.C. Dawgs","Oceana","Ocean Alley","Ocean, Billy","Ocean, Frank","Oceanlab","Ocean Park Standoff","Oceans Ate Alaska","Oceans Divide","O'Connor, Sinead","October Fall","O'Day, Aubrey","Odd Future Wolf Gang Kill Them All","Odell, Tom","Odessa","ODESZA","O'Donis, Colby","Ofenbach","OFFAIAH","Off Bloom","Offset","Offspring, The","Of Mice & Men","Of Monsters And Men","Of Montreal","Ogie Alcasid","OG Maco","O\u011fuzhan Ko\u00e7","Oh Hellos, The","Oh Honey","Ohio Players","Oh Land","Oh My Girl","Oh, Sleeper","Oh Wonder","Oingo Boingo","O'Jays, The","OJ Da Juiceman","OK Go","Okkervil River","Olamide","Old 97's","Old Crow Medicine Show","Old Dominion","Oldfield, Mike","Ol' Dirty Bastard","Oleander","Oleta Adams","Olexesh","Oliver Heldens","Olivia","Olivia Holt","Olivia Newton-John","Olivia O'Brien","Olivver The Kid","Olly Murs","Olsen, Angel","Olsen, Steven Lee","Olstead, Renee","Omarion","Omar, Xavier","OMB Peezy","OMC","OMG Girlz","Omi","O'Neal, Jamie","One Chance","One Direction","O'Neil, Melissa","One Less Reason","One Night Only","ONE OK ROCK","OneRepublic","One Sonic Society","One True Voice","One Voice","Ong, Daryl","Only The Young","Onyx","Onze:20","Oomph!","Opeth","OPM","Orange & Lemons","Ora, Rita"]

获取歌曲

此方法返回艺术家的歌曲。

printsongs("Oasis")
The above command will return the following:
{"albums":{"\"Definitely Maybe\"":["Rock 'n' Roll Star","Shakermaker","Live Forever","Up In The Sky","Columbia","Supersonic","Bring It On Down","Cigarettes & Alcohol","Digsy's Diner","Slide Away","Married With Children","Sad Song"],"\"Dig Out Your Soul\"":["(As Long As They've Got) Cigarettes In Hell","(I Got) The Fever","Alice","Alive","Angel Child","Boy With The Blues","Carry Us All","Cloudburst","Cum On Feel The Noize","D'Yer Wanna Be A Spaceman","Eyeball Tickler","Flashbax","Full On","Helter Skelter","Heroes","I Will Believe","Idler's Dream","If We Shadows","It's Better People","Just Getting Older","Let's All Make Believe","My Sister Lover","One Way Road","Round Are Way","Step Out","Street Fighting Man","Take Me","Take Me Away","The Fame","Whatever","You've Got To Hide Your Love Away"],"\"Be Here Now\"":["D'You Know What I Mean?","My Big Mouth","Magic Pie","Stand By Me","I Hope, I Think, I Know","The Girl In The Dirty Shirt","Fade In-Out","Don't Go Away","Be Here Now","All Around The World","It's Getting Better (Man!!)"],"\"Standing On The Shoulder Of Giants\"":["Fuckin' In The Bushes","Go Let It Out","Who Feels Love?","Put Yer Money Where Yer Mouth Is","Little James","Gas Panic!","Where Did It All Go Wrong?","Sunday Morning Call","I Can See A Liar","Roll It Over"],"\"Heathen Chemistry\"":["The Hindu Times","Force Of Nature","Hung In A Bad Place","Stop Crying Your Heart Out","Song Bird","Little By Little","(Probably) All In The Mind","She Is Love","Born On A Different Cloud","Better Man"],"\"Don't Believe The Truth\"":["Turn Up The Sun","Mucky Fingers","Lyla","Love Like A Bomb","The Importance Of Being Idle","The Meaning Of Soul","Guess God Thinks I'm Abel","Part Of The Queue","Keep The Dream Alive","A Bell Will Ring","Let There Be Love"],"\"(What's The Story) Morning Glory\"":["Hello","Roll With It","Wonderwall","Don't Look Back In Anger","Hey Now","Some Might Say","Cast No Shadow","She's Electric","Morning Glory","Champagne Supernova","Bonehead's Bank Holiday"],"\"The Masterplan\"":["Acquiesce","Underneath The Sky","Talk Tonight","Going Nowhere","Fade Away","I Am The Walrus (Live)","Listen Up","Rockin' Chair","Half The World Away","(It's Good) To Be Free","Stay Young","Headshrinker","The Masterplan"]},"artist":"oasis"}

获取歌词

此方法返回歌曲的歌词。

printlyrics("Oasis","Magic Pie")
The above command returns the following:
[u"\n\r\nAn extraordinary guy\nCan never have an ordinary day,\nHe might live a long goodbye\nBut that is not for me to say\nI dig his friends, I dig his shoes\nBut he is just a child with nothing to lose\nBut his mind \n\nThey are sleeping while they dream\nAnd then they want to be adored\nThey who don't say what they mean\nWill live and die by their own sword.\nI dig their friends, I dig their shoes\nBut they are like a child with nothing to lose\nIn their minds, their minds. \n\nBut I'll have my way\nIn my own time\nI'll have my say\nMy star will shine \n\nCos you see me I got my Magic Pie\nThink of me yeah that was me I was that passer by\nI've been and now I've gone. \n\nThere are but a thousand days preparing for a thousand years\nMany minds to educate and people who have disappeared\nD'you dig my friends? D'you dig my shoes?\nI am like a child with nothing to lose but my mind\nMy mind\n"]

根据您的使用情况,您可能需要逐行打印;

fromazlyricsimportlyricswd=lyrics("Oasis","Magic Pie")forlineinwd:print(line)

将输出为;

An extraordinary guy
Can never have an ordinary day,
He might live a long goodbye
But that is not for me to say
I dig his friends, I dig his shoes
But he is just a child with nothing to lose
But his mind

They are sleeping while they dream
And then they want to be adored
They who don't say what they mean
Will live and die by their own sword.
I dig their friends, I dig their shoes
But they are like a child with nothing to lose
In their minds, their minds.

But I'll have my way
In my own time
I'll have my say
My star will shine

Cos you see me I got my Magic Pie
Think of me yeah that was me I was that passer by
I've been and now I've gone.

There are but a thousand days preparing for a thousand years
Many minds to educate and people who have disappeared
D'you dig my friends? D'you dig my shoes?
I am like a child with nothing to lose but my mind
My mind

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java Selenium“findElement”找不到现有对象   java hibernate如何在JPA风格的引导过程中注册实体类   java为什么getX()方法首先执行而不是构造函数   Java写入int的第一个字节   java Word文档到html解析器,保留所有文本样式(下标、上标、项目符号等)   为每个java对象实例生成唯一字符串   Java类卡片枚举示例。修订过的   Android与Java内部类概念   在java中优化x小数位的答案   从队列的挂起消息列表中提取消息时出现java性能问题   java查找正则表达式的哪个部分导致了匹配   Java8函数“包装器”函数,在执行给定的lambda之前执行某些操作?   带有限定符@Default的ZZZZ类型的java未满足依赖项   如何在java中将XML文件转换为LaTex?   Android中的java封闭文本边界?   java如何更改此代码,使其更新当前用户而不是创建新用户?   java spring启动应用程序属性暂存和生产   Java:如何将字符串转换为int   java跟踪NullPointerException的最佳方法是什么?   java为什么我的JAR文件在与ProGuard混淆后不能运行?主类正在变得模糊/库