Heckie75 / kodi-addon-podcast

Subscribe to podcasts in KODI
MIT License
14 stars 3 forks source link

Fails to Parse RSS Feed With No XML Processing Instruction #16

Closed stobb3s closed 3 years ago

stobb3s commented 3 years ago

I have a podcast feed that won't open, and the error message says "Unexpected Content". The URL is here. After inspecting the code, the part that fails is:

        if not res.startswith("<?xml"):
            raise HttpStatusError("%s %s" % (
                settings.getLocalizedString(32094), url))

If you open the URL, you can see that the first element is <rss>, not <?xml>. It appears this feed does not include the xml processing instruction and immediately starts with <rss>. You may want to take this possibility into account in your code. For example, I changed it to the following, and it fixed the issue:

        if not (res.startswith("<?xml") or res.startswith("<rss")):
Heckie75 commented 3 years ago

Huuh, strange. Starting xml files with <?xml is standard since 1999. Don't you think that the problem is the service that provides this file?

Does xmltodict reads that document w/o <?xml?

stobb3s commented 3 years ago

Does xmltodict reads that document w/o <?xml?

Yes, when I changed the code to the above, it read just fine.

Starting xml files with <?xml is standard since 1999. Don't you think that the problem is the service that provides this file?

According the RSS spec, all RSS files must conform to the XML 1.0 spec. And according to that spec, all XML files must include processing instructions. So yes, this particular file does not conform to the spec.

Since you are the developer, it's your decision whether or not to support an out-of-spec file. But this feed opens with no issues in gPodder and AntennaPod.

Heckie75 commented 3 years ago

Ok, let me known the answer according the encoding issue, especially if there is no further need for it.

According the xml thing, I changed it as follows:

        if not res.startswith("<?xml") and not res.startswith("<rss"):

BTW: It is within a git submodule that is used by all my podcast addons.

stobb3s commented 3 years ago

Ok. The latest update plugin.audio.podcasts.2.2.1-pre2.zip fixed the issue for me. Thanks for your support.