(self, content)
Parses the OPML feed from the given URL into a local data structure
        containing podcast metadata.
Parses the OPML feed from the given URL into a local data structure
        containing podcast metadata.
Parses the OPML feed from the given URL into a local data structure containing podcast metadata .
def __init__(self, content):
        """
        Parses the OPML feed from the given URL into a local data structure
        containing podcast metadata.
        """
        self.items = []

        try:
            doc = xml.dom.minidom.parseString(content)
        except ExpatError as e:
            raise ValueError from e

        for outline in doc.getElementsByTagName("outline"):
            if (
                outline.getAttribute("type") in self.VALID_TYPES
                and outline.getAttribute("xmlUrl")
                or outline.getAttribute("url")
            ):
                channel = {
                    "url": outline.getAttribute("xmlUrl")
                    or outline.getAttribute("url"),
                    "title": outline.getAttribute("title")
                    or outline.getAttribute("text")
                    or outline.getAttribute("xmlUrl")
                    or outline.getAttribute("url"),
                    "description": outline.getAttribute("text")
                    or outline.getAttribute("xmlUrl")
                    or outline.getAttribute("url"),
                }

                if channel["description"] == channel["title"]:
                    channel["description"] = channel["url"]

                for attr in ("url", "title", "description"):
                    channel[attr] = channel[attr].strip()

                self.items.append(channel)
def __init__ ( self , content ) : self . items = [ ] try : doc = xml . dom . minidom . parseString ( content ) except ExpatError as e : raise ValueError from e for outline in doc . getElementsByTagName ( "outline" ) : if ( outline . getAttribute ( "type" ) in self . VALID_TYPES and outline . getAttribute ( "xmlUrl" ) or outline . getAttribute ( "url" ) ) : channel = { "url" : outline . getAttribute ( "xmlUrl" ) or outline . getAttribute ( "url" ) , "title" : outline . getAttribute ( "title" ) or outline . getAttribute ( "text" ) or outline . getAttribute ( "xmlUrl" ) or outline . getAttribute ( "url" ) , "description" : outline . getAttribute ( "text" ) or outline . getAttribute ( "xmlUrl" ) or outline . getAttribute ( "url" ) , } if channel [ "description" ] == channel [ "title" ] : channel [ "description" ] = channel [ "url" ] for attr in ( "url" , "title" , "description" ) : channel [ attr ] = channel [ attr ] . strip ( ) self . items . append ( channel )