0

I am trying to read data from directory and trying to parse that data and finally trying to write it to another directory.

for this i am using Jython Evaluator. Here is my code:

import sys
sys.path.append('/usr/lib/python2.7/site-packages')
import feedparser

for record in records:
  myfeed = feedparser.parse(str(record))
  for item in myfeed['items']:
    title = item.title
    link = item.link
  output.write(record) 

I am able to write data to output, but my requirement is write title and link which are parsed from input record.

Here is my code snippet:

enter image description here

any suggestions please.

Thanks in advance.

ROOT
  • 1,757
  • 4
  • 34
  • 60
  • What are you trying to parse? I don't think `str(record)` will give you anything useful - is your input data in a field in the record? – metadaddy Sep 11 '18 at 15:02

1 Answers1

0

You need to write the values to the record, see below where we are adding the record value and assigning title and link respectively.

import sys
sys.path.append('/usr/lib/python2.7/site-packages')
import feedparser

for record in records:
  myfeed = feedparser.parse(str(record))
  for item in myfeed['items']:
    record.value["title"] = item.title
    record.value["link"] = item.link
  output.write(record)