{"id":248,"date":"2007-04-11T22:22:58","date_gmt":"2007-04-11T22:22:58","guid":{"rendered":"http:\/\/beta.robertprice.co.uk\/robblog\/2007\/04\/python_xml_and_itunes-shtml\/"},"modified":"2007-04-11T22:22:58","modified_gmt":"2007-04-11T22:22:58","slug":"python_xml_and_itunes-shtml","status":"publish","type":"post","link":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/","title":{"rendered":"Python, XML and iTunes"},"content":{"rendered":"<p>\nAs I&#8217;ve taken the week off work, I thought as well as spending time with my family, I&#8217;d brush up my Python skills as they&#8217;ve been a bit neglected of late.\n<\/p>\n<p>\nI&#8217;ve never tried XML parsing with Python so thought I&#8217;d cover that. Apple&#8217;s <a href=\"http:\/\/www.apple.com\/itunes\/\">iTunes<\/a> has the ability to export information about your music in XML and I&#8217;d been meaning to take a look at that for a while. Why not combine the two, so here&#8217;s my take on parsing iTunes export information with Python.\n<\/p>\n<p>\nI thought i&#8217;d work on a small subset of my library, the ones I&#8217;ve actually paid to download from iTunes compared to the ones converted from CD.\n<\/p>\n<p>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/robblog\/images\/pythonitunes.gif\" width=\"600\" height=\"424\" alt=\"Rob's purchased iTunes tracks\" class=\"blogimage\" \/>\n<\/p>\n<p>\nThe exported XML data is a bit peculiar. I would have assumed it to be values enclosed by sensible tag names e.g <code>&lt;artist&gt;Human League&lt;\/artist&gt;<\/code>. However, it&#8217;s actually a bunch of neighbouring tags and values like this <code>&ltkey&gt;Artist&lt;\/key&gt;&lt;string&gt;Sheb Wooley&lt;\/string&gt;<\/code>\n<\/p>\n<p>\nHere&#8217;s a snippet from the actual data export I ran&#8230;\n<\/p>\n<div class=\"code\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;<br \/>\n&lt;!DOCTYPE plist PUBLIC \"-\/\/Apple Computer\/\/DTD PLIST 1.0\/\/EN\" \"http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd\"&gt;<br \/>\n&lt;plist version=\"1.0\"&gt;<br \/>\n&lt;dict&gt;<br \/>\n&lt;key&gt;Major Version&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Minor Version&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Application Version&lt;\/key&gt;&lt;string&gt;6.0.5&lt;\/string&gt;<br \/>\n&lt;key&gt;Features&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Music Folder&lt;\/key&gt;&lt;string&gt;file:\/\/localhost\/D:\/Documents%20and%20Settings\/Windows%20User\/My%20Documents\/My%20Music\/iTunes\/iTunes%20Music\/&lt;\/string&gt;<br \/>\n&lt;key&gt;Library Persistent ID&lt;\/key&gt;&lt;string&gt;C5DD29C89369B278&lt;\/string&gt;<br \/>\n&lt;key&gt;Tracks&lt;\/key&gt;<br \/>\n&lt;dict&gt;<br \/>\n&lt;key&gt;312&lt;\/key&gt;<br \/>\n&lt;dict&gt;<br \/>\n&lt;key&gt;Track ID&lt;\/key&gt;&lt;integer&gt;312&lt;\/integer&gt;<br \/>\n&lt;key&gt;Name&lt;\/key&gt;&lt;string&gt;The Purple People Eater&lt;\/string&gt;<br \/>\n&lt;key&gt;Artist&lt;\/key&gt;&lt;string&gt;Sheb Wooley&lt;\/string&gt;<br \/>\n&lt;key&gt;Album&lt;\/key&gt;&lt;string&gt;20th Century Rocks: 50's Rock 'n Roll - At the Hop&lt;\/string&gt;<br \/>\n&lt;key&gt;Genre&lt;\/key&gt;&lt;string&gt;Pop&lt;\/string&gt;<br \/>\n&lt;key&gt;Kind&lt;\/key&gt;&lt;string&gt;Protected AAC audio file&lt;\/string&gt;<br \/>\n&lt;key&gt;Size&lt;\/key&gt;&lt;integer&gt;2260837&lt;\/integer&gt;<br \/>\n&lt;key&gt;Total Time&lt;\/key&gt;&lt;integer&gt;135533&lt;\/integer&gt;<br \/>\n&lt;key&gt;Disc Number&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Disc Count&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Track Number&lt;\/key&gt;&lt;integer&gt;5&lt;\/integer&gt;<br \/>\n&lt;key&gt;Year&lt;\/key&gt;&lt;integer&gt;2001&lt;\/integer&gt;<br \/>\n&lt;key&gt;Date Modified&lt;\/key&gt;&lt;date&gt;2006-09-28T09:54:23Z&lt;\/date&gt;<br \/>\n&lt;key&gt;Date Added&lt;\/key&gt;&lt;date&gt;2006-09-28T09:54:10Z&lt;\/date&gt;<br \/>\n&lt;key&gt;Bit Rate&lt;\/key&gt;&lt;integer&gt;128&lt;\/integer&gt;<br \/>\n&lt;key&gt;Sample Rate&lt;\/key&gt;&lt;integer&gt;44100&lt;\/integer&gt;<br \/>\n&lt;key&gt;Play Count&lt;\/key&gt;&lt;integer&gt;11&lt;\/integer&gt;<br \/>\n&lt;key&gt;Play Date&lt;\/key&gt;&lt;integer&gt;-1042489964&lt;\/integer&gt;<br \/>\n&lt;key&gt;Play Date UTC&lt;\/key&gt;&lt;date&gt;2007-01-24T08:55:32Z&lt;\/date&gt;<br \/>\n&lt;key&gt;Normalization&lt;\/key&gt;&lt;integer&gt;7764&lt;\/integer&gt;<br \/>\n&lt;key&gt;Compilation&lt;\/key&gt;&lt;true\/&gt;<br \/>\n&lt;key&gt;Artwork Count&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Persistent ID&lt;\/key&gt;&lt;string&gt;302B45E87F01479F&lt;\/string&gt;<br \/>\n&lt;key&gt;Track Type&lt;\/key&gt;&lt;string&gt;File&lt;\/string&gt;<br \/>\n&lt;key&gt;Protected&lt;\/key&gt;&lt;true\/&gt;<br \/>\n&lt;key&gt;Location&lt;\/key&gt;&lt;string&gt;file:\/\/localhost\/D:\/Documents%20and%20Settings\/Windows%20User\/My%20Documents\/My%20Music\/iTunes\/iTunes%20Music\/Compilations\/20th%20Century%20Rocks_%2050's%20Rock%20'n%20Roll%20-\/05%20The%20Purple%20People%20Eater.m4p&lt;\/string&gt;<br \/>\n&lt;key&gt;File Folder Count&lt;\/key&gt;&lt;integer&gt;4&lt;\/integer&gt;<br \/>\n&lt;key&gt;Library Folder Count&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;\/dict&gt;<br \/>\n&lt;key&gt;313&lt;\/key&gt;<br \/>\n&lt;dict&gt;<br \/>\n&lt;key&gt;Track ID&lt;\/key&gt;&lt;integer&gt;313&lt;\/integer&gt;<br \/>\n&lt;key&gt;Name&lt;\/key&gt;&lt;string&gt;Daisy Daisy&lt;\/string&gt;<br \/>\n&lt;key&gt;Artist&lt;\/key&gt;&lt;string&gt;Johnny O'Tolle &amp;#38; His Naughty Band&lt;\/string&gt;<br \/>\n&lt;key&gt;Album&lt;\/key&gt;&lt;string&gt;Gay 90's&lt;\/string&gt;<br \/>\n&lt;key&gt;Genre&lt;\/key&gt;&lt;string&gt;Vocal&lt;\/string&gt;<br \/>\n&lt;key&gt;Kind&lt;\/key&gt;&lt;string&gt;Protected AAC audio file&lt;\/string&gt;<br \/>\n&lt;key&gt;Size&lt;\/key&gt;&lt;integer&gt;2346412&lt;\/integer&gt;<br \/>\n&lt;key&gt;Total Time&lt;\/key&gt;&lt;integer&gt;125084&lt;\/integer&gt;<br \/>\n&lt;key&gt;Disc Number&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Disc Count&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Track Number&lt;\/key&gt;&lt;integer&gt;2&lt;\/integer&gt;<br \/>\n&lt;key&gt;Track Count&lt;\/key&gt;&lt;integer&gt;10&lt;\/integer&gt;<br \/>\n&lt;key&gt;Year&lt;\/key&gt;&lt;integer&gt;2006&lt;\/integer&gt;<br \/>\n&lt;key&gt;Date Modified&lt;\/key&gt;&lt;date&gt;2006-09-28T09:59:52Z&lt;\/date&gt;<br \/>\n&lt;key&gt;Date Added&lt;\/key&gt;&lt;date&gt;2006-09-28T09:59:38Z&lt;\/date&gt;<br \/>\n&lt;key&gt;Bit Rate&lt;\/key&gt;&lt;integer&gt;128&lt;\/integer&gt;<br \/>\n&lt;key&gt;Sample Rate&lt;\/key&gt;&lt;integer&gt;44100&lt;\/integer&gt;<br \/>\n&lt;key&gt;Play Count&lt;\/key&gt;&lt;integer&gt;6&lt;\/integer&gt;<br \/>\n&lt;key&gt;Play Date&lt;\/key&gt;&lt;integer&gt;-1038647848&lt;\/integer&gt;<br \/>\n&lt;key&gt;Play Date UTC&lt;\/key&gt;&lt;date&gt;2007-03-09T20:10:48Z&lt;\/date&gt;<br \/>\n&lt;key&gt;Artwork Count&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;key&gt;Persistent ID&lt;\/key&gt;&lt;string&gt;302B45E87F01490F&lt;\/string&gt;<br \/>\n&lt;key&gt;Track Type&lt;\/key&gt;&lt;string&gt;File&lt;\/string&gt;<br \/>\n&lt;key&gt;Protected&lt;\/key&gt;&lt;true\/&gt;<br \/>\n&lt;key&gt;Location&lt;\/key&gt;&lt;string&gt;file:\/\/localhost\/D:\/Documents%20and%20Settings\/Windows%20User\/My%20Documents\/My%20Music\/iTunes\/iTunes%20Music\/Johnny%20O'Tolle%20&amp;#38;%20His%20Naughty%20Band\/Gay%2090's\/02%20Daisy%20Daisy.m4p&lt;\/string&gt;<br \/>\n&lt;key&gt;File Folder Count&lt;\/key&gt;&lt;integer&gt;4&lt;\/integer&gt;<br \/>\n&lt;key&gt;Library Folder Count&lt;\/key&gt;&lt;integer&gt;1&lt;\/integer&gt;<br \/>\n&lt;\/dict&gt;<br \/>\n<\/code><\/div>\n<p>\nThis makes parsing the data a bit trickier than I had hoped for. I was hoping to use a nice simple XPath expression, but data like this looks like it&#8217;s more a job for a SAX based approach.\n<\/p>\n<p>\nI took a look in O&#8217;Reilly&#8217;s excellent <a href=\"http:\/\/www.amazon.co.uk\/gp\/product\/0596009259?ie=UTF8&#038;tag=robertprcouk-21&#038;linkCode=as2&#038;camp=1634&#038;creative=6738&#038;creativeASIN=0596009259\">Programming Python<\/a><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.assoc-amazon.co.uk\/e\/ir?t=robertprcouk-21&#038;l=as2&#038;o=2&#038;a=0596009259\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" style=\"border:none !important; margin:0px !important;\" \/>, and found a nice SAX parser example to modify.\n<\/p>\n<p>\nAs it&#8217;s just a quick test, I&#8217;m making a few assumptions on the XML data that a production system would have to handle. In this case, I&#8217;m assume a tag order of Track ID, Name and Artist. Using this order, each time we see one of those tags come past, we can make up a Track object and store the relevant data. In this case, when we see Track ID we need a new Track object to store the data in. When we see Name, we store the track name in the object and when we see Artist we save the artist, push the Track object to our list of Tracks and clear the current Track object.\n<\/p>\n<p>\nThat&#8217;s a bit long winded, so here&#8217;s the code.\n<\/p>\n<div class=\"code\"><code>import xml.sax.handler<br \/>\nclass ITunesHandler(xml.sax.handler.ContentHandler):<br \/>\ndef __init__(self):<br \/>\nself.parsing_tag = False<br \/>\nself.tag = ''<br \/>\nself.value = ''<br \/>\nself.tracks = []<br \/>\nself.track = None<br \/>\ndef startElement(self, name, attributes):<br \/>\nif name == 'key':<br \/>\nself.parsing_tag = True<br \/>\ndef characters(self, data):<br \/>\nif self.parsing_tag:<br \/>\nself.tag = data<br \/>\nself.value = ''<br \/>\nelse:<br \/>\n# could be multiple lines, so append data.<br \/>\nself.value = self.value + data<br \/>\ndef endElement(self,name):<br \/>\nif name == 'key':<br \/>\nself.parsing_tag = False<br \/>\nelse:<br \/>\nif self.tag == 'Track ID':<br \/>\n# start of a new track, so a new object<br \/>\n# is needed.<br \/>\nself.track = Track()<br \/>\nelif self.tag == 'Name' and self.track:<br \/>\nself.track.track = self.value<br \/>\nelif self.tag == 'Artist' and self.track:<br \/>\nself.track.artist = self.value<br \/>\n# assume this is all the data we need<br \/>\n# so append the track object to our list<br \/>\n# and reset our track object to None.<br \/>\nself.tracks.append(self.track)<br \/>\nself.track = None<br \/>\nclass Track:<br \/>\ndef __init__(self):<br \/>\nself.track = ''<br \/>\nself.artist = ''<br \/>\ndef __str__(self):<br \/>\nreturn \"Track  = %snArtist = %s\" % (self.track,self.artist)<br \/>\n<\/code><\/div>\n<p>\nIn the real world, the Track class would offer a lot more functionality, in this case, it&#8217;s just for holding data and providing a pretty printer.\n<\/p>\n<p>\nNow we need to parse the XML and display the results, here&#8217;s the code&#8230;\n<\/p>\n<div class=\"code\"><code>parser = xml.sax.make_parser()<br \/>\nhandler = ITunesHandler()<br \/>\nparser.setContentHandler(handler)<br \/>\nparser.parse('D:\\Documents and Settings\\Windows User\\Desktop\\Purchased.xml')<br \/>\nfor track in handler.tracks:<br \/>\nprint track<br \/>\n<\/code><\/div>\n<p>\nLet&#8217;s run that code and see what we get&#8230;\n<\/p>\n<div class=\"code\"><code>Track  = The Purple People Eater<br \/>\nArtist = Sheb Wooley<br \/>\nTrack  = Daisy Daisy<br \/>\nArtist = Johnny O'Tolle &amp; His Naughty Band<br \/>\nTrack  = Don't Dilly Dally<br \/>\nArtist = Kidzone<br \/>\nTrack  = Jump In My Car<br \/>\nArtist = David Hasselhoff<br \/>\nTrack  = Puff, the Magic Dragon<br \/>\nArtist = Peter, Paul And Mary<br \/>\nTrack  = You Give Love a Bad Name<br \/>\nArtist = Bon Jovi<br \/>\nTrack  = Heart of Glass<br \/>\nArtist = Blondie<br \/>\nTrack  = Grace Kelly<br \/>\nArtist = Mika<br \/>\nTrack  = Standing In the Way of Control<br \/>\nArtist = Gossip<br \/>\nTrack  = Physical<br \/>\nArtist = Olivia Newton-John<br \/>\nTrack  = Don't You Want Me<br \/>\nArtist = The Human League<br \/>\nTrack  = Have a Drink On Me<br \/>\nArtist = Lonnie Donegan<br \/>\nTrack  = My Old Man's a Dustman<br \/>\nArtist = Lonnie Donegan<br \/>\n<\/code><\/div>\n<p>\nThat&#8217;s great! OK, I&#8217;m not going to win any awards for my taste in music, but at least I can now think about building music services that use this data.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I&#8217;ve taken the week off work, I thought as well as spending time with my family, I&#8217;d brush up my Python skills as they&#8217;ve been a bit neglected of late. I&#8217;ve never tried XML parsing with Python so thought I&#8217;d cover that. Apple&#8217;s iTunes has the ability to export information about your music in &hellip; <a href=\"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Python, XML and iTunes&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[17,53,80],"class_list":["post-248","post","type-post","status-publish","format-standard","hentry","category-dev","tag-dev","tag-python","tag-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python, XML and iTunes - Robert Price<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python, XML and iTunes - Robert Price\" \/>\n<meta property=\"og:description\" content=\"As I&#8217;ve taken the week off work, I thought as well as spending time with my family, I&#8217;d brush up my Python skills as they&#8217;ve been a bit neglected of late. I&#8217;ve never tried XML parsing with Python so thought I&#8217;d cover that. Apple&#8217;s iTunes has the ability to export information about your music in &hellip; Continue reading &quot;Python, XML and iTunes&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/\" \/>\n<meta property=\"og:site_name\" content=\"Robert Price\" \/>\n<meta property=\"article:published_time\" content=\"2007-04-11T22:22:58+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.assoc-amazon.co.uk\/e\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259\" \/>\n<meta name=\"author\" content=\"rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/\"},\"author\":{\"name\":\"rob\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"headline\":\"Python, XML and iTunes\",\"datePublished\":\"2007-04-11T22:22:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/\"},\"wordCount\":447,\"image\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.assoc-amazon.co.uk\\\/e\\\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259\",\"keywords\":[\"Dev\",\"Python\",\"XML\"],\"articleSection\":[\"Dev\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/\",\"name\":\"Python, XML and iTunes - Robert Price\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.assoc-amazon.co.uk\\\/e\\\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259\",\"datePublished\":\"2007-04-11T22:22:58+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/#primaryimage\",\"url\":\"http:\\\/\\\/www.assoc-amazon.co.uk\\\/e\\\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259\",\"contentUrl\":\"http:\\\/\\\/www.assoc-amazon.co.uk\\\/e\\\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/python_xml_and_itunes-shtml\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python, XML and iTunes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\",\"name\":\"Robert Price\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\",\"name\":\"rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"caption\":\"rob\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python, XML and iTunes - Robert Price","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/","og_locale":"en_GB","og_type":"article","og_title":"Python, XML and iTunes - Robert Price","og_description":"As I&#8217;ve taken the week off work, I thought as well as spending time with my family, I&#8217;d brush up my Python skills as they&#8217;ve been a bit neglected of late. I&#8217;ve never tried XML parsing with Python so thought I&#8217;d cover that. Apple&#8217;s iTunes has the ability to export information about your music in &hellip; Continue reading \"Python, XML and iTunes\"","og_url":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/","og_site_name":"Robert Price","article_published_time":"2007-04-11T22:22:58+00:00","og_image":[{"url":"http:\/\/www.assoc-amazon.co.uk\/e\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259","type":"","width":"","height":""}],"author":"rob","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rob","Estimated reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/#article","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/"},"author":{"name":"rob","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"headline":"Python, XML and iTunes","datePublished":"2007-04-11T22:22:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/"},"wordCount":447,"image":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/#primaryimage"},"thumbnailUrl":"http:\/\/www.assoc-amazon.co.uk\/e\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259","keywords":["Dev","Python","XML"],"articleSection":["Dev"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/","url":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/","name":"Python, XML and iTunes - Robert Price","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/#primaryimage"},"image":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/#primaryimage"},"thumbnailUrl":"http:\/\/www.assoc-amazon.co.uk\/e\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259","datePublished":"2007-04-11T22:22:58+00:00","author":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"breadcrumb":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/#primaryimage","url":"http:\/\/www.assoc-amazon.co.uk\/e\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259","contentUrl":"http:\/\/www.assoc-amazon.co.uk\/e\/ir?t=robertprcouk-21&l=as2&o=2&a=0596009259"},{"@type":"BreadcrumbList","@id":"https:\/\/www.robertprice.co.uk\/robblog\/python_xml_and_itunes-shtml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robertprice.co.uk\/robblog\/"},{"@type":"ListItem","position":2,"name":"Python, XML and iTunes"}]},{"@type":"WebSite","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website","url":"https:\/\/www.robertprice.co.uk\/robblog\/","name":"Robert Price","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robertprice.co.uk\/robblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5","name":"rob","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","caption":"rob"}}]}},"_links":{"self":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/comments?post=248"}],"version-history":[{"count":0,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/248\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media?parent=248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/categories?post=248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/tags?post=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}