Skip to content

Commit 6a21e8e

Browse files
committed
feat: add LinkedIn publication time filter support
1 parent fbd96a8 commit 6a21e8e

4 files changed

Lines changed: 17 additions & 0 deletions

File tree

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SEARCH_GEO_ID=106057199
77
SEARCH_LANGUAGE=pt
88
REMOTE_ONLY=true
99
JOB_TYPES=C,F
10+
TIME_FILTER=r604800
1011
SEARCH_KEYWORDS=UX Designer,UI Designer,Product Manager,Product Owner
1112

1213
# Scraping behavior

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Todas sao opcionais.
4949
- `SEARCH_LANGUAGE` (padrao: `pt`)
5050
- `JOB_TYPES` (padrao: `C,F`)
5151
Valores comuns: `C` (PJ), `F` (CLT), `C,F` (ambos)
52+
- `TIME_FILTER` (padrao: `r604800`)
53+
Valores comuns: `r86400` (24h), `r604800` (7 dias), `r2592000` (30 dias)
5254
- `SEARCH_KEYWORDS` (lista separada por virgula)
5355

5456
Exemplo no Windows cmd (Brasil remoto, PJ+CLT):

src/config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ function parseKeywords(value) {
4545
return keywords.length > 0 ? keywords : DEFAULT_KEYWORDS;
4646
}
4747

48+
function parseTimeFilter(value, fallback) {
49+
if (!value) {
50+
return fallback;
51+
}
52+
53+
const normalized = String(value).trim();
54+
return /^r\d+$/.test(normalized) ? normalized : fallback;
55+
}
56+
4857
export function getConfig() {
4958
return {
5059
headless: parseBoolean(process.env.HEADLESS, false),
@@ -62,6 +71,8 @@ export function getConfig() {
6271
searchLanguage: process.env.SEARCH_LANGUAGE || "pt",
6372
remoteOnly: parseBoolean(process.env.REMOTE_ONLY, true),
6473
jobTypes: process.env.JOB_TYPES || "C,F",
74+
// f_TPR examples: r86400 (24h), r604800 (7 dias), r2592000 (30 dias)
75+
timeFilter: parseTimeFilter(process.env.TIME_FILTER, "r604800"),
6576
keywords: parseKeywords(process.env.SEARCH_KEYWORDS)
6677
};
6778
}

src/linkedinScraper.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ function buildSearchUrl(keyword, config, start = 0) {
1313
if (config.jobTypes) {
1414
url.searchParams.set("f_JT", config.jobTypes);
1515
}
16+
if (config.timeFilter) {
17+
url.searchParams.set("f_TPR", config.timeFilter);
18+
}
1619
url.searchParams.set("start", String(start));
1720
return url.toString();
1821
}

0 commit comments

Comments
 (0)