Created
          September 20, 2015 10:13 
        
      - 
      
- 
        Save andreif/c3480111638830812fcd to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from collections import OrderedDict | |
| import json | |
| from urllib.request import urlopen | |
| import xml.etree.ElementTree as ET | |
| xml = urlopen(url=url).read() | |
| items = [] | |
| for item in ET.fromstring(xml).findall('channel')[0].findall('item'): | |
| items.append(OrderedDict((i.tag, i.text) for i in item)) | |
| print(json.dumps(items, indent=2)) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment