diff --git a/README.md b/README.md index 441f4d0..793b3c4 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ See [Environment variables](#environment-variables) for configuration options. | `LINEUP_ID` | Lineup ID; You can find this at https://tvlistings.gracenote.com/grid-affiliates.html?aid=orbebb | String | `USA-lineupId-DEFAULT` (Attenna) | | `TIMESPAN` | Either 3 or 6 hours of shows | Integer | 3 | | `PREF` | User Preferences, comma separated list. `m` for showing music, `p` for showing pay-per-view, `h` for showing HD | String | (empty) | +| `COUNTRY` | Country code (default: `US`) | String | US | | `POSTAL_CODE` | Postal code of where shows are available. | Integer | 30309 | | `USER_AGENT` | Custom user agent string for HTTP requests. | String | Uses random if not specified | | `TZ` | Timezone | String | System default | @@ -62,6 +63,7 @@ See [Environment variables](#environment-variables) for configuration options. | `--lineupId` | Lineup ID; You can find this at https://tvlistings.gracenote.com/grid-affiliates.html?aid=orbebb | String | `USA-lineupId-DEFAULT` (Attenna) | | `--timespan` | Either 3 or 6 hours of shows | Integer | 3 | | `--pref` | User Preferences, comma separated list. `m` for showing music, `p` for showing pay-per-view, `h` for showing HD | String | (empty) | +| `--country` | Country code (default: `US`) | String | US | | `--postalCode` | Postal code of where shows are available. | Integer | 30309 | | `--userAgent` | Custom user agent string for HTTP requests. | String | Uses random if not specified | | `--timezone` | Timezone | String | System default | diff --git a/src/config.ts b/src/config.ts index 61e7758..67c9a68 100644 --- a/src/config.ts +++ b/src/config.ts @@ -10,6 +10,10 @@ export const config = { process.env.TIMESPAN || process.argv.find((arg) => arg.startsWith("--timespan="))?.split("=")[1] || "3", + country: + process.env.COUNTRY || + process.argv.find((arg) => arg.startsWith("--country="))?.split("=")[1] || + "USA", postalCode: process.env.POSTAL_CODE || process.argv diff --git a/src/index.ts b/src/index.ts index c06425a..fc0c2d2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,8 @@ Options: --help Show this help message --lineupId=ID Lineup ID (default: USA-lineupId-DEFAULT) --timespan=NUM Timespan in hours (default: 3) ---pref=LIST User preferences, comma separated. Can be m, p, and h (default: empty) +--pref=LIST User preferences, comma separated. Can be m, p, and h (default: empty)' +--country=CON Country code (default: USA) --postalCode=ZIP Postal code (default: 30309) --userAgent=UA Custom user agent string (default: Uses random if not specified) --timezone=TZ Timezone (default: America/New_York) diff --git a/src/tvlistings.ts b/src/tvlistings.ts index 09779da..9bdd6df 100644 --- a/src/tvlistings.ts +++ b/src/tvlistings.ts @@ -83,7 +83,7 @@ function buildUrl() { lineupId: config.lineupId, timespan: config.timespan, headendId: "lineupId", - country: "USA", + country: config.country, timezone: config.timezone, postalCode: config.postalCode, isOverride: "true", @@ -109,7 +109,7 @@ export async function getTVListings(): Promise { if (!response.ok) { throw new Error( - `Failed to fetch: ${response.status} ${response.statusText}`, + `Failed to fetch: ${response.status} ${response.statusText}` ); }