Quantcast
Channel: Alexa Skill FeedHelper.js - how can i get the enclosure URL? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Alexa Skill FeedHelper.js - how can i get the enclosure URL?

$
0
0

I am using a blueprint from Amazon to develop an Alexa feed skill. In this blueprint, RSS feeds are called from an URL and transformed into JSON format and saved on Amazon S3.

This file is responsible to do that action (and it works well for the standard elements)

https://github.com/alexa/skill-sample-nodejs-feed/blob/master/lambda/custom/feedHelper.js

I need now also the enclosure url, because i want to play a podcast. I thought it will work by adding following into the feedHelper.js in Line 63:

                        if (item['enclosure']) {
                        feedItem['enclosureUrl'] = item['enclosure'].attributes['url'];
                    }

But the JSON which is generated on S3 with help of this file has still no enclosure element in there. Did I even call it correctly?

I also tried already:

                        if (item['enclosure']) {
                        feedItem['enclosureUrl'] = item['enclosure'].url;
                    }

and

                        if (item['enclosure']) {
                        feedItem['enclosureUrl'] = item['enclosure']['url'];
                    }

The other issue is, that the audio link is linked with https:// and Amazon don't accept HTTP... But when I put in this address manually in the browser bar with https in front, the download works. So hopefully I am able to just change the HTTP from the enclosure tag into https like described here?

http://code.dblock.org/2017/02/09/alexa-skill-to-play-your-podcast.html

So to summarize above: I need this element from an RSS feed

      <enclosure type="audio/mpeg" url="http://feeds.soundcloud.com/stream/file.mp3" length="7087881"/>

to be written in the JSON that is created with the feedHelper.js

Currently, it did not generate any enclosure element in the json, despite my code above.

Does anyone have an idea?

Thank you!


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images