- 
      
- 
        Save otienog1/29192e70ff71d98e3cbd8958f5c065f7 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