[development] Programmatic data importing from JSON source

Paul Hoza paulhoza at gmail.com
Sun Feb 15 14:33:01 UTC 2009


Hello folks,

I've been struggling for a long time (way too long) to get a data feed 
imported into CCK nodes.  I've attempted a plethora of different 
strategies, including but not limited to:  FeedAPI, Feed Element Mapper, 
custom parsers, hacking parsers, tweaking mappers, Yahoo! Pipes to 
create custom feed versions of the original feed, serialized PHP 
exports, etc.

I'm tired of the project, but I have to find a way to get this to work.

So, I found a few articles on programmatically creating CCK nodes and 
I'm hoping to connect with anyone who's had experience doing this with 
JSON data.  There is an XML/RSS version of this feed I need, but it 
sucks compared to the JSON version, with respect to how much data is in 
there and how it's formatted.  The XML version hides a lot of crucial 
info into a <summary> element... which I might be able to parse through 
separately, but RSS feed aggregators just ignore stuff in there.  Again, 
I'd have to make a custom parser to get in there.

Here's an article that hits about as close as I've seen yet.  I am 
leaving for a couple days, so I'll try to get something like this 
working when I get back, but I hoped to hear from anyone who's done the 
same thing.  Information on using JSON data to create nodes is sparse, 
but this article hits pretty close to the mark:
  https://secure.prolucid.com/node/43
I had read other posts about doing similar methods using 
drupal_execute(), et. al, but they all talk only about XML as data 
source.  I haven't found anything talking about JSON or (un)serialized 
PHP sources.

What I really need to do is do an initial import of the JSON feed into 
my CCK node (which is a huge feed of 6,200+ items).  After that, I want 
to check the feed every day for changes and create new daily nodes 
accordingly -- which is why FeedAPI really seemed like the ticket, aside 
from my massive struggles with making my own parser.  For now, I'd be 
happy with a PHP script that I could call daily with cron.


Thanks for any feedback... sorry for the long post.  Part rant, part 
plea.  :)

Cheers,
Paul Hoza



More information about the development mailing list