Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin: extract-object #26

Open
cldellow opened this issue Dec 26, 2022 · 0 comments
Open

plugin: extract-object #26

cldellow opened this issue Dec 26, 2022 · 0 comments

Comments

@cldellow
Copy link
Owner

TODO: name and schema is up in the air.

      // TODO: determine schema for this
      "extract-selectors": {
        // TODO: flag to indicate whether we should mark up the source to
        //       make it more amenable for CSS extraction

        // TODO: how to do invariant things, eg if we wanted to build
        //       out a join table of categories, we'd extract the category
        //       from the same root HTML element... how to infer that?

        // TODO: how to do many-to-many, if such a thing exists? maybe it's
        //       an advanced case and can be ignored.
        "url-regex": "/garments/",

        // optional
        "database": "dbname",
        "extractors": {
          "patterns": {
            "selector": ".w-full.container",
            "attributes": {
              "url!": [
                "h3 a",
                { "attribute": "href" }
              ],
              "name": [
                "h3 a",
                { "text": true }
              ],
              "designer_name": [
                "h3 + p a",
                { "text": true }
              ]
            }
          },
          "pattern_categories": {
            "selector": ".w-full.container",
            "attributes": {
              "url!": [
                "h3 a",
                { "attribute": "href" }
              ],
              "category!": [
                "html h1",
                { "text": true }
              ]
            }
          }
        ]
      }
    }

Needs https://github.com/cldellow/datasette-scraper#extract_from_responsescraper-config-url-response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant