How to Read Binary File to XML?

I've xml files with URLs to mp3 files. Is there a software out there that could read the xml file and start downloading all the mp3 files listed in the xml file?

  • Answer:

    You don't need an additional software for that simple task. Execute something like the following in the folder your xmlfile is found (by replacing the dots at the beginning by spaces or tabulators and 'TP' by 'http') in Python (you don't have? Get it at http://python.org ) def download(file): ..import urllib ..file = open(file, 'r') ..document = file.read() ..for charpos in range(len(document))[3:]: ....if document[charpos-4:charpos] == '.mp3': ......music = urllib.urlopen(document[document[:charpos].rindex('TP://') : charpos]) ......localfile = open( document[document[:charpos].rindex('/')+1 : charpos], 'w' ) ......localfile.write(music.read()) ......music.close() ......localfile.close() ..file.close() download('yourxmlfile.xml')

wekkaw at Answerbag.com Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.