I need to extract ID3 tags and metadata of deleted mp3 files.
I wrote a few lines that could get the ID3 tags of the local file:
from mutagen.mp3 import MP3 import urllib2 audio = MP3("Whistle.mp3") songtitle = audio["TIT2"] artist = audio["TPE1"] print "Title: " + str(songtitle) print "Artist: "+str(artist)
I need to achieve this for links to links for mp3 files. I tried to get partial file upload using urllib2.
import urllib2 from mutagen.mp3 import MP3 req = urllib2.Request('http://www.1songday.com/wp-content/uploads/2013/08/Lorde-Royals.mp3') req.headers['Range'] = 'bytes=%s-%s' % (0, 100) response = urllib2.urlopen(req) headers = response.info() print headers.type print headers.maintype data = response.read() print len(data)
How can I extract ID3 tags from an MP3 URL without fully downloading a file?
python metadata id3 mutagen
Anish
source share