Soapbox / laravel-formatter

A Formatter Class for Laravel 4 based on FuelPHP's Formatter Class
249 stars 95 forks source link

Trying to parse an iTunes XML feed but iTunes tags missing #31

Open shealan opened 9 years ago

shealan commented 9 years ago

I'm trying to import an iTunes podcast feed but the iTunes specific tags are being ignored and are not included in the resulting array.

Here's an example of a feed: http://rss.earwolf.com/how-did-this-get-made

All the tags with "itunes:something" are missing from the generated array.

I'd be really grateful for any suggestions you might have on fixing this?

florentsuc commented 8 years ago

I had the same problem.

That's linked to the namespaces, but an easy way is to remove the colons before formating.

You will get <itunessomething> instead of <itunes:something>.

Example:

$podcastsXmlString = file_get_contents("http://your/feed.xml");
$podcastsXmlString = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $podcastsXmlString);
$podcastsXml = Formatter::make($podcastsXmlString, Formatter::XML);
dev2552 commented 5 years ago

.