5

I am developing a python program which can extract ID3 tags of mp3 files. I am using urllib2 for checking MIME type of the URL (if it is audio/mpeg), after that I need to find information about this MP3 file.

Problem is, I dont want to load that Mp3 file completely in my PC, I just want to extract ID3 tags? so is it possible to extract them without downloading MP3 file completely because downloading will slow down my process?

Please suggest something.

Thanks,

4

1 回答 1

3

You can do a partial download: Download file using partial download (HTTP) (if the server supports it)

on rereading, and seeing joelhardi's comment, this is even easier:

jcomeau@intrepid:/tmp$ python
Python 2.6.6 (r266:84292, Apr 20 2011, 11:58:30) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.urlopen('http://latest/temp.csv')
<addinfourl at 160617676 whose fp = <socket._fileobject object at 0x9872aec>>
>>> input=_
>>> input.read(128)
'gene,species,C_frame,start_exon1,end_exon1,start_exon2,end_exon2,start_exon3,end_exon3,start_exon4,end_exon4,intron1,intron2,int'
>>> input.close()
>>>
于 2011-05-26T06:28:26.927 回答