Skip to content

Refactor: Wire up or remove unused selector_recipes.py module #65

Description

@MozzamShahid

File / lines: src/gmaps_scraper/selector_recipes.py (whole file); src/gmaps_scraper/place_scraper.py; src/gmaps_scraper/__init__.py

Problem: selector_recipes.py defines selector recipes and is exported from the public API (default_place_selector_recipe, load_place_selector_recipe, write_default_place_selector_recipe). However, it is only used to write a debug artifact in debug_dump.py. The real extraction logic hardcodes the same selectors in _PLACE_JS_EXTRACTOR and helper JS strings. Users can load a custom recipe, but it has no effect on extraction.

Why it matters: This creates an orphan abstraction. Users have false expectations, and selector changes must be maintained in two places.

Suggested fix (choose one):

  • Option A: Generate the JS evaluator from the recipe so custom recipes actually drive extraction.
  • Option B: Remove the module from the public API and stop writing selector-recipe.json in debug dumps.

Add tests for whichever option is chosen.

Difficulty: medium
Impact: Medium — improves maintainability and API honesty.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions