Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MacBook-Pro-de-Rodrigo:~ rodorgas$ python3
- Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41)
- [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import re
- >>> from robobrowser import RoboBrowser
- >>> browser = RoboBrowser(history=True)
- >>> browser.open('http://www.azlyrics.com/')
- >>> print('Stage A')
- Stage A
- >>> form = browser.get_form(role = 'search')
- >>> form['q'].value = 'Bohemian Rhapsody'
- >>> browser.submit_form(form)
- >>> print('Stage B')
- Stage B
- >>> songs = browser.select('.text-left a')
- >>> print('Stage C')
- Stage C
- >>> browser.follow_link(songs[2])
- >>> lyrics = browser.select('body > div:nth-of-type(3) > div:nth-of-type(1) > div:nth-of-type(2) > div:nth-of-type(6)')
- >>> lyrics = lyrics[0].text.strip()
- >>> print(lyrics)
- Is this the real life?
- Is this just fantasy?
- Caught in a landslide,
- No escape from reality.
- Open your eyes,
- Look up to the skies and see,
- I'm just a poor boy, I need no sympathy,
- Because I'm easy come, easy go,
- Little high, little low,
- Anyway the wind blows doesn't really matter to me, to me.
- Mama, just killed a man,
- Put a gun against his head,
- Pulled my trigger, now he's dead.
- Mama, life had just begun,
- But now I've gone and thrown it all away.
- Mama, ooh,
- Didn't mean to make you cry,
- If I'm not back again this time tomorrow,
- Carry on, carry on as if nothing really matters.
- Too late, my time has come,
- Sent shivers down my spine,
- Body's aching all the time.
- Goodbye, everybody, I've got to go,
- Gotta leave you all behind and face the truth.
- Mama, ooh (anyway the wind blows),
- I don't wanna die,
- I sometimes wish I'd never been born at all.
- I see a little silhouetto of a man,
- Scaramouche, Scaramouche, will you do the Fandango?
- Thunderbolt and lightning,
- Very, very frightening me.
- (Galileo) Galileo.
- (Galileo) Galileo,
- Galileo Figaro
- Magnifico.
- I'm just a poor boy, nobody loves me.
- He's just a poor boy from a poor family,
- Spare him his life from this monstrosity.
- Easy come, easy go, will you let me go?
- Bismillah! No, we will not let you go. (Let him go!)
- Bismillah! We will not let you go. (Let him go!)
- Bismillah! We will not let you go. (Let me go!)
- Will not let you go. (Let me go!)
- Never, never let you go
- Never let me go, oh.
- No, no, no, no, no, no, no.
- Oh, mama mia, mama mia (Mama mia, let me go.)
- Beelzebub has a devil put aside for me, for me, for me.
- So you think you can stone me and spit in my eye?
- So you think you can love me and leave me to die?
- Oh, baby, can't do this to me, baby,
- Just gotta get out, just gotta get right outta here.
- (Oh, yeah, oh yeah)
- Nothing really matters,
- Anyone can see,
- Nothing really matters,
- Nothing really matters to me.
- Anyway the wind blows.
- >>> print('Stage D')
- Stage D
- >>> browser.back()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement