I'm pulling RSS data from this URL and this is how their data structure looks like.
<item>
<itunes:episodeType>full</itunes:episodeType>
<itunes:season>6</itunes:season>
<itunes:episode>49</itunes:episode>
<itunes:season>6</itunes:season>
</item>
It has duplicate child element itunes:season. How do I correctly parse it in JavaSCript? Any help will be apprciated! :)
here is the gist of my code:
success: function(data) {
.find("item")
.each(function() {
const el = $(this);
const seasonLS = el.find("itunes\\:season").text();
const episodeLS = el.find("itunes\\:episode").text();
};
I tried fetching it by the childname but the duplicate childnames are throwing it off.
Edit:
Sorry for the unclear question. Here is more information.
-
The expected output for itunes:season is 6. This one spits out 66.
-
.find is chained on below:
const RSS_URL = *** URL ***
;
$.ajax(RSS_URL, {
accepts: {
xml: "application/rss+xml"
},
dataType: "xml",
success: function(data) {
console.log(data)
$(data) .find("item")...
source https://stackoverflow.com/questions/77311041/i-have-duplicate-child-elements-in-my-rss-feed-wont-parse-it-in-javascript
No comments:
Post a Comment