matthewmueller / x-ray

The next web scraper. See through the <html> noise.
MIT License
5.87k stars 349 forks source link

is it possible to have keys based on the selector in the output? #235

Closed techyrajeev closed 5 years ago

techyrajeev commented 7 years ago

Subject of the issue

Dynamic key in the output

Environment

Steps to reproduce

Basically I am just trying to extract some information and want to set object keys based on the data present in website.

      x(html,
          '.parent-group',
              {
                    groups:'.temp-section',
                    '.title':'.detail'
                }
         )

But in result I am getting

{
    groups:"some value",
   '.title':"some value"
}

Not the actual extracted value of .title

techyrajeev commented 6 years ago

Has this been fixed in new version?

lathropd commented 5 years ago

This can be done by using a .map function on the result later.