node-osmosis icon indicating copy to clipboard operation
node-osmosis copied to clipboard

Support for building nested data from set

Open RichieMerchant opened this issue 8 years ago • 0 comments

I'm trying to build a list of shows with episodes as a nested array. I'm able to get the nested list but it pushes all content into a single array.

osmosis.get("....")
  .find("div.main ul > li:first a")
  .set("genre")
  .delay(2000)
  .follow("@href")
  .find("div.main ul li:first a")
  .delay(2000)
  .follow("@href")
  .find("div.main")
  .set({
    title: "div.ui-grid-solo div.ui-block-a div.ui-bar h1",
    description: "#category_description div + div > div > div p",
    image: "#category_description div > div img@src",
    genres: ["#category_description div + div + div > div > p a"],
    type: "#category_description div + div + div > div > p + p a",
    episodes: [
      osmosis
        .find("div.main ul li a")
        .delay(2000)
        .follow("@href")
        .set({ title: "title" })
    ]
  })```

Is there anything wrong with this setup?

The array section of the episodes data. Everything is in one array item. It also includes the page data from the current page as the first section of the array item. 

[Episodes-Response.txt](https://github.com/rchipka/node-osmosis/files/1203621/Episodes-Response.txt)

Not sure what I'm doing wrong. Any help is welcome. Thanks 

RichieMerchant avatar Aug 07 '17 01:08 RichieMerchant