473,405 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

first python program.. lyrics search

Hi

I'm trying to learn python by doing something that I think it would be
nice; Search lyrics using some websites like www.musicsonglyrics.com,
http://www.sing365.com
I am trying to parse the html code and get the information that i need.
Since I am not very good with programing I am stuck on this part.
Let's take the www.musicsonglyrics.com website as an example. So let's
say Metallica lyrics would be on www.musicsonglyrics.com/M.htm. Getting
the first letter, requesting the M.htm page and checking if Metallica is
in the html code is easy. Here is what I did up to now:

artist = raw_input("Name of the artist: ")
music = raw_input("Name of the music: ")
url = "http://www.musicsonglyrics.com/" + artist[0].capitalize() + ".htm"
f =
urllib2.urlopen(url)

found = 0
lines = f.readlines()
f.close()
for x in lines:
if x.find(artist) != -1:
found = 1

if found:
print "OK"
else:
print "No"
The problem is once I have the M.htm page I don't now how to get from
the html code the "http://www.musicsonglyrics.com/M/Metallica/Metallica
lyrics.htm" link to proceed with the search. I tried to read about
Regular Expressions but I think I'm to dumb for it.

Any ideas? Maybe my approach is completely wrong....

Appreciate any help
Gustavo
Jul 18 '05 #1
1 1726
In article <ma**************************************@python.o rg>,
Gustavo Rahal <li****@grahal.net> wrote:
Hi

I'm trying to learn python by doing something that I think it would be
nice; Search lyrics using some websites like www.musicsonglyrics.com,
http://www.sing365.com [ ... ]
The problem is once I have the M.htm page I don't now how to get from
the html code the "http://www.musicsonglyrics.com/M/Metallica/Metallica
lyrics.htm" link to proceed with the search. I tried to read about
Regular Expressions but I think I'm to dumb for it.

Any ideas? Maybe my approach is completely wrong....


Look up htmllib in Python libraries. It's not a small
job, but you'll have learned a lot by the time you've
finished.

Good Luck. Mel.
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
28
by: Jay | last post by:
OK, I have this XML doc, i dont know much about XML, but what i want to do is take certain parts of the XML doc, such as </title> blah </title> and take just that and put onto a text doc. Then...
35
by: Michel Sanner | last post by:
Hello, One of the greatest feature of Python in my opinion is the way the interpreter can be used to integrate a wide variety of software packages by dynamically linking them. This approach has...
9
by: News | last post by:
I am new in using Python Anyone know how to implement breadth first search using Python? Can Python create list dynamically, I want to implement a program which will read data from a file and...
3
by: aldonnelley | last post by:
Hi all. Just having a weird problem with tkinter. I'm trying to make a gui that shows results from an image search, with a "forward" and "back" button so the user can compare results from...
0
by: Wilbert Berendsen | last post by:
Hi all, I'm just new to this list and I'm a musician and hobby programmer. I am busy with LilyKDE, a python plugin package for KDE's editor Kate, that makes using the LilyPond music typesetter from...
9
by: Jimmy | last post by:
Well, i know it may be a little non-python thing, however, I can think of no place better to post this question :) can anyone tell me, in python, how to obtain some information of a running...
19
by: John Salerno | last post by:
Hey all. Just thought I'd ask a general question for my own interest. Every time I think of something I might do in Python, it usually involves creating a GUI interface, so I was wondering what kind...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.