Import external content

I want to parse a RSS feed and import data into content store.
Can you guide me in the right direction on how to accomplish this?

Enonic version: 6.4.x


Hey Mathis,

You could try:

  1. Use ** http-client library** (http://repo.enonic.com/public/com/enonic/xp/docs/6.4.2/docs-6.4.2-libdoc.zip!/module-lib_xp_http-client.html#.request) to get the content from the rss feed.

  2. Use lib content to save the XML as a unstructured document or use http://rss2json.com/ API to convert RSS to JSON and then save the json

I would have wrapped it in an REST service (http://xp.readthedocs.org/en/stable/developer/services/index.html) for easy use

//runar

4 Likes

Thanks, Runar. This is a huge step on the road. I would like to automate the process, e.g. daily import different RSS-feeds into contentstore, checking if content exist etc.

How do you recommend solving the automation?

How about a CRON job to send a request to the service URL?

Can you set up Enonic to run CRON jobs for you? If so - how? There should probably be some kind of simple API for registering CRON tasks imo - I can think of tons of use cases already :sunny:

Think Michael is simply referring to good ol Linux cron here…

We will however deliver a “native” cluster-safe XP CRON equivalent with API’s in the not too distant future :grin:

3 Likes