{
  "description": "Scrape hyperlocal US news, events and classifieds from Patch.com by keyword, town, category, author, tag or URL, with optional full body text, detail-page enrichment and new-record monitoring.",
  "properties": {
    "authorName": {
      "default": "",
      "description": "Exact byline/reporter/poster name (required for mode=byAuthor; on any other mode it is an extra server-side filter). Copy it from this actor's `author` output field, e.g. \"Eric Heyl\".",
      "editor": "textfield",
      "prefill": "",
      "title": "Author name",
      "type": "string"
    },
    "category": {
      "default": "",
      "description": "News category/topic to filter by (required for mode=byCategory; optional filter on mode=search/byTown/byAuthor/byTag). Not applicable to mode=events/classifieds -- use `classifiedCategory` for mode=classifieds instead.",
      "editor": "select",
      "enum": [
        "",
        "around-town",
        "arts-entertainment",
        "bulletinboard",
        "business",
        "going-green",
        "holidays",
        "kids-family",
        "lifestyle",
        "obituaries",
        "personal-finance",
        "pets",
        "police-fire",
        "politics",
        "real-estate",
        "restaurants-bars",
        "schools",
        "small-business-voices",
        "sports",
        "traffic-transit",
        "travel",
        "weather"
      ],
      "enumTitles": [
        "(any category)",
        "Community Corner",
        "Arts & Entertainment",
        "Neighbor News",
        "Business",
        "Home & Garden",
        "Seasonal & Holidays",
        "Kids & Family",
        "Health & Fitness",
        "Obituaries",
        "Personal Finance",
        "Pets",
        "Crime & Safety",
        "Politics & Government",
        "Real Estate",
        "Restaurants & Bars",
        "Schools",
        "Local Voices",
        "Sports",
        "Traffic & Transit",
        "Travel",
        "Weather"
      ],
      "prefill": "",
      "title": "Category",
      "type": "string"
    },
    "classifiedCategory": {
      "default": "",
      "description": "Classifieds category to filter by (mode=classifieds only; a completely separate value set from `category`, which is news-only). Leave as \"(any category)\" to browse every classified category.",
      "editor": "select",
      "enum": [
        "",
        "announcements",
        "for-sale",
        "free-stuff",
        "gigs-services",
        "housing",
        "lost-found",
        "news-tip",
        "opinion",
        "other",
        "question",
        "recommendation"
      ],
      "enumTitles": [
        "(any category)",
        "Announcements",
        "For Sale",
        "Free Stuff",
        "Gigs & Services",
        "Housing",
        "Lost & Found",
        "News Tip",
        "Opinion",
        "Other",
        "Question",
        "Recommendation"
      ],
      "prefill": "",
      "title": "Classified category",
      "type": "string"
    },
    "eventDateAfter": {
      "description": "mode=events only. Only include events occurring on or after this date (the event's own date, not when it was posted to Patch -- see `publishedAfter` for that). Format: YYYY-MM-DD. Combine with `eventDateBefore` for a date range, e.g. \"what's happening this weekend\".",
      "editor": "textfield",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "title": "Event date after (YYYY-MM-DD)",
      "type": "string"
    },
    "eventDateBefore": {
      "description": "mode=events only. Only include events occurring on or before this date. Format: YYYY-MM-DD. Combine with `eventDateAfter` for a date range.",
      "editor": "textfield",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "title": "Event date before (YYYY-MM-DD)",
      "type": "string"
    },
    "includeBodyText": {
      "default": true,
      "description": "Add bodyHtml (the original HTML), bodyText (readable plain text) and bodyLength to each record. Article/event/classified bodies come from Patch's own search payload, so this costs no extra request.",
      "prefill": false,
      "title": "Include full body text",
      "type": "boolean"
    },
    "includeDetails": {
      "default": false,
      "description": "Fetch each record's Patch page and add gallery images/captions/credits, author avatar and points, comment/reply counts, breaking/sponsored flags, town grade/weekly views/ZIPs/timezone/county/metro, event venue/type/website, and classified contact state. One extra request per record; failed pages never discard the base record.",
      "prefill": false,
      "title": "Enrich from detail pages",
      "type": "boolean"
    },
    "maxDetails": {
      "default": 100,
      "description": "How many records to enrich when `includeDetails` is on. 0 means every emitted record (up to `maxItems`). Ignored when detail enrichment is off.",
      "maximum": 1000,
      "minimum": 0,
      "prefill": 0,
      "title": "Max detail pages",
      "type": "integer"
    },
    "maxItems": {
      "default": 25,
      "description": "Maximum number of articles, events or classifieds to return (1-1000). Requests above 250 are automatically split into date partitions to bypass Patch's 250-hit search-key window.",
      "maximum": 1000,
      "minimum": 1,
      "prefill": 3,
      "title": "Max results",
      "type": "integer"
    },
    "mode": {
      "default": "search",
      "description": "What to fetch from Patch.com.",
      "editor": "select",
      "enum": [
        "search",
        "byTown",
        "byCategory",
        "byAuthor",
        "byTag",
        "events",
        "classifieds",
        "byUrl"
      ],
      "enumTitles": [
        "Search by keyword",
        "Browse latest news for a town/city",
        "Browse by category",
        "Browse articles by author/reporter",
        "Browse articles by editorial tag",
        "Browse local events (calendar)",
        "Browse local classifieds (marketplace listings)",
        "Scrape Patch URLs (article, event, classified, town, topic, state or search)"
      ],
      "prefill": "search",
      "title": "Mode",
      "type": "string"
    },
    "monitorKey": {
      "default": "",
      "description": "Optional namespace for monitor state. Give different saved tasks different keys to keep their seen-ID lists separate. Derived automatically from the mode and filters when empty.",
      "editor": "textfield",
      "prefill": "",
      "title": "Monitor key",
      "type": "string"
    },
    "monitorMode": {
      "default": false,
      "description": "Emit only records whose Patch ID has not been seen by an earlier run with the same monitor key. State is stored in the actor's key-value store.",
      "prefill": false,
      "title": "Monitor: only new records",
      "type": "boolean"
    },
    "nearLat": {
      "description": "Latitude of a point to search near (combine with `nearLng` and `radiusMiles`). News modes only (search/byTown/byCategory/byAuthor/byTag) -- not available for mode=events/classifieds, whose Patch indexes don't expose a filterable location field. Both `nearLat` and `nearLng` must be set together; otherwise this filter is ignored.",
      "maximum": 90,
      "minimum": -90,
      "title": "Near latitude",
      "type": "number"
    },
    "nearLng": {
      "description": "Longitude of a point to search near (combine with `nearLat` and `radiusMiles`). News modes only -- see `nearLat` description. Both `nearLat` and `nearLng` must be set together; otherwise this filter is ignored.",
      "maximum": 180,
      "minimum": -180,
      "title": "Near longitude",
      "type": "number"
    },
    "publishedAfter": {
      "description": "Only include articles/events/classifieds posted to Patch on or after this date (i.e. listing date, not an event's own occurrence date -- see `eventDateAfter` for that). Format: YYYY-MM-DD. Combine with `publishedBefore` for a date range.",
      "editor": "textfield",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "title": "Published after (YYYY-MM-DD)",
      "type": "string"
    },
    "publishedBefore": {
      "description": "Only include articles/events/classifieds posted to Patch on or before this date. Format: YYYY-MM-DD. Combine with `publishedAfter` for a date range.",
      "editor": "textfield",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "title": "Published before (YYYY-MM-DD)",
      "type": "string"
    },
    "radiusMiles": {
      "default": 25,
      "description": "Search radius around `nearLat`/`nearLng`, in miles. News modes only -- see `nearLat` description. Ignored unless both `nearLat` and `nearLng` are set.",
      "maximum": 500,
      "minimum": 1,
      "prefill": 25,
      "title": "Radius (miles)",
      "type": "integer"
    },
    "regionSlug": {
      "default": "",
      "description": "US state/edition to scope results to (required for mode=byTown; optional filter on every other mode). \"Across America\" is Patch's national edition (code US); \"US Territories\" is a valid Patch region with no current articles.",
      "editor": "select",
      "enum": [
        "",
        "across-america",
        "alabama",
        "alaska",
        "arizona",
        "arkansas",
        "california",
        "colorado",
        "connecticut",
        "delaware",
        "district-columbia",
        "florida",
        "georgia",
        "hawaii",
        "idaho",
        "illinois",
        "indiana",
        "iowa",
        "kansas",
        "kentucky",
        "louisiana",
        "maine",
        "maryland",
        "massachusetts",
        "michigan",
        "minnesota",
        "mississippi",
        "missouri",
        "montana",
        "nebraska",
        "nevada",
        "new-hampshire",
        "new-jersey",
        "new-mexico",
        "new-york",
        "north-carolina",
        "north-dakota",
        "ohio",
        "oklahoma",
        "oregon",
        "pennsylvania",
        "rhode-island",
        "south-carolina",
        "south-dakota",
        "tennessee",
        "texas",
        "us-territories",
        "utah",
        "vermont",
        "virginia",
        "washington",
        "west-virginia",
        "wisconsin",
        "wyoming"
      ],
      "enumTitles": [
        "(any state - nationwide)",
        "Across America (national edition)",
        "Alabama",
        "Alaska",
        "Arizona",
        "Arkansas",
        "California",
        "Colorado",
        "Connecticut",
        "Delaware",
        "District of Columbia",
        "Florida",
        "Georgia",
        "Hawaii",
        "Idaho",
        "Illinois",
        "Indiana",
        "Iowa",
        "Kansas",
        "Kentucky",
        "Louisiana",
        "Maine",
        "Maryland",
        "Massachusetts",
        "Michigan",
        "Minnesota",
        "Mississippi",
        "Missouri",
        "Montana",
        "Nebraska",
        "Nevada",
        "New Hampshire",
        "New Jersey",
        "New Mexico",
        "New York",
        "North Carolina",
        "North Dakota",
        "Ohio",
        "Oklahoma",
        "Oregon",
        "Pennsylvania",
        "Rhode Island",
        "South Carolina",
        "South Dakota",
        "Tennessee",
        "Texas",
        "US Territories",
        "Utah",
        "Vermont",
        "Virginia",
        "Washington",
        "West Virginia",
        "Wisconsin",
        "Wyoming"
      ],
      "prefill": "",
      "title": "State",
      "type": "string"
    },
    "searchMatch": {
      "default": "allWords",
      "description": "How multi-word searches match. \"All words\" requires every word anywhere in the headline/summary/topic (more results). \"Exact phrase\" requires the words to appear together (the old behavior).",
      "editor": "select",
      "enum": [
        "allWords",
        "exactPhrase"
      ],
      "enumTitles": [
        "All words anywhere",
        "Exact phrase"
      ],
      "prefill": "allWords",
      "title": "Search match",
      "type": "string"
    },
    "searchQuery": {
      "description": "Free-text keyword to search for (mode=search; also applies to mode=events/classifieds and to scope URLs). Leave empty to browse the newest articles matching the other filters.",
      "editor": "textfield",
      "prefill": "city council",
      "title": "Search query",
      "type": "string"
    },
    "sortBy": {
      "default": "relevance",
      "description": "Order of results. \"Nearest first\" requires both `nearLat`/`nearLng` AND mode=search/byTown/byCategory/byAuthor/byTag (news); otherwise it falls back to Relevance. \"Soonest event first\" requires mode=events; on any other mode it also falls back to Relevance.",
      "editor": "select",
      "enum": [
        "relevance",
        "newest",
        "oldest",
        "nearest",
        "eventDate"
      ],
      "enumTitles": [
        "Relevance",
        "Newest first",
        "Oldest first",
        "Nearest first (requires nearLat/nearLng, news modes only)",
        "Soonest event first (requires mode=events)"
      ],
      "prefill": "relevance",
      "title": "Sort by",
      "type": "string"
    },
    "startUrls": {
      "description": "mode=byUrl only. Paste Patch article, event, classified, town, category/topic, state or search URLs. Article/event/classified URLs are scraped directly; town/topic/state/search URLs are converted into the equivalent scoped query.",
      "editor": "requestListSources",
      "items": {
        "properties": {
          "url": {
            "description": "A full Patch.com URL (or patch.com/... path).",
            "title": "URL",
            "type": "string"
          }
        },
        "type": "object"
      },
      "title": "Patch URLs",
      "type": "array"
    },
    "tagName": {
      "default": "",
      "description": "Exact editorial tag (required for mode=byTag; on article modes it is an extra filter). Copy it from this actor's `tags` field, e.g. \"Back To School\". Only a minority of articles carry tags.",
      "editor": "textfield",
      "prefill": "",
      "title": "Tag name",
      "type": "string"
    },
    "townSlug": {
      "default": "",
      "description": "Patch town/city URL slug (required for mode=byTown; requires regionSlug too). Find it in a Patch URL, e.g. patch.com/california/santamonica -> \"santamonica\". Example: \"santamonica\" (with regionSlug=california).",
      "editor": "textfield",
      "prefill": "",
      "title": "Town/city slug",
      "type": "string"
    }
  },
  "required": [
    "mode"
  ],
  "schemaVersion": 1,
  "title": "Patch Scraper Input",
  "type": "object"
}
