Reuse Selectors in different sitemaps

Hi, is it possible to define a selector globally, so you can refer to it across multiple sitemaps?

e.g. if you are scraping a car website - i.e. autotrader or similar. You could setup different sitemaps, i.e. one to scrape Fords, then another to get BMWs, then another for Audis etc..

Currently, as far as I know, you'd need to duplicate the selectors in each sitemap, which is fine and it works, but then if they change their website and it breaks the selectors, you then have to go an edit every single sitemap.

Just wondering if there was a way around this?

Not really clear what you mean, without a sitemap or example Url.

You could try using more robust selectors, CSS Selector Reference.

In particular, refer to the examples for:

  • attribute containing the word
  • attribute value begins with
  • attribute value ends with
  • attribute value contains the substring
  • Selects every YYY element that are preceded by a XXX element