document option category

This commit is contained in:
Bo Peng
2025-05-14 12:22:06 -05:00
parent 995834e6a1
commit 9c61e2da92
2 changed files with 28 additions and 20 deletions

View File

@@ -246,7 +246,7 @@ The following options that can specified for both `marketplace` sections and `it
| `max_price` | Optional | Integer/String | Maximum price, can be followed by a currency name. |
| `max_search_interval` | Optional | String | Maximum interval in seconds between searches. If specified, a random time will be chosen between `search_interval` and `max_search_interval`. |
| `min_price` | Optional | Integer/String | Minimum price, can be followed by a currency name. |
| `category` | Optional | String | Category of search |
| `category` | Optional | String | Category of search. |
| `notify` | Optional | String/List | Users who should be notified. |
| `ai` | Optional | String/List | AI services to use, default to all specified services. `ai=[]` will disable ai. |
| `city_name` | Optional | String/List | Corresponding name of `search_city`. |
@@ -270,6 +270,7 @@ Note that
4. `start_at` supports one or more of the following values: <br> - `HH:MM:SS` or `HH:MM` for every day at `HH:MM:SS` or `HH:MM:00` <br> - `*:MM:SS` or `*:MM` for every hour at `MM:SS` or `MM:00` <br> - `*:*:SS` for every minute at `SS`.
5. A list of two values can be specified for options `rating`, `availability`, `delivery_method`, and `date_listed`. See [First and subsequent searches](../README.md#first-and-subsequent-searches) for details.
6. `min_price` and `max_price` can be specified as a number (e.g. `min_price=100`) or a number followed by a currency name (e.g. `min_price='100 USD'`). If different currencies are specified for both `min_price/max_price` and `search_city` (or `region`), the `min_price` and `max_price` will be adjusted to use currency for the `search_city`. See [Searching across regions with different currencies](../README.md#searching-across-regions-with-different-currencies) for details.
7. `category` can be `vehicles`, `propertyrentals`, `apparel`, `electronics`, `entertainment`, `family`, `freestuff`, `garden`, `hobbies`, `homegoods`, `homeimprovement`, `homesales`, `musicalinstruments`, `officesupplies`, `petsupplies`, `sportinggoods`, `tickets`, `toys`, and `videogames`. If `catgory=freestuff` is set, `min_price` and `max_price` is ignored.
### Regions

View File

@@ -56,25 +56,25 @@ class Availability(Enum):
class Category(Enum):
VEHICLES = 'vehicles'
PROPERTY_RENTALS = 'propertyrentals'
APPAREL = 'apparel'
ELECTRONICS = 'electronics'
ENTERTAINMENT = 'entertainment'
FAMILY = 'family'
FREE_STUFF = 'freestuff'
GARDEN = 'garden'
HOBBIES = 'hobbies'
HOME_GOODS = 'homegoods'
HOME_IMPROVEMENT = 'homeimprovement'
HOME_SALES = 'homesales'
MUSICAL_INSTRUMENTS = 'musicalinstruments'
OFFICE_SUPPLIES = 'officesupplies'
PET_SUPPLIES = 'petsupplies'
SPORTING_GOODS = 'sportinggoods'
TICKETS = 'tickets'
TOYS = 'toys'
VIDEO_GAMES = 'videogames'
VEHICLES = "vehicles"
PROPERTY_RENTALS = "propertyrentals"
APPAREL = "apparel"
ELECTRONICS = "electronics"
ENTERTAINMENT = "entertainment"
FAMILY = "family"
FREE_STUFF = "freestuff"
GARDEN = "garden"
HOBBIES = "hobbies"
HOME_GOODS = "homegoods"
HOME_IMPROVEMENT = "homeimprovement"
HOME_SALES = "homesales"
MUSICAL_INSTRUMENTS = "musicalinstruments"
OFFICE_SUPPLIES = "officesupplies"
PET_SUPPLIES = "petsupplies"
SPORTING_GOODS = "sportinggoods"
TICKETS = "tickets"
TOYS = "toys"
VIDEO_GAMES = "videogames"
@dataclass
@@ -432,6 +432,13 @@ class FacebookMarketplace(Marketplace):
category = item_config.category or self.config.category
if category:
options.append(f"category={category}")
if category == Category.FREE_STUFF.value:
# find min_price= and max_price= in options and remove them
options = [
x
for x in options
if not x.startswith("minPrice=") and not x.startswith("maxPrice=")
]
for search_phrase in item_config.search_phrases:
if self.logger: