-
Notifications
You must be signed in to change notification settings - Fork 0
/
const.py
215 lines (193 loc) · 5.56 KB
/
const.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
import os
import re
from datetime import date
VERSION_PATH = "/home/joepers/code/jj"
CIV_DB_PATH = os.path.join(VERSION_PATH, "dbs/civ_db")
SCH_DB_PATH = os.path.join(VERSION_PATH, "dbs/sch_db")
UNI_DB_PATH = os.path.join(VERSION_PATH, "dbs/uni_db")
PUSH_RESULTS_PATH = os.path.join(VERSION_PATH, "push_results.sh")
JORB_HOME_PATH = "/home/joepers/joes_jorbs"
DATER_PATH = os.path.join(JORB_HOME_PATH, date.today().isoformat())
RESULTS_PATH = os.path.join(DATER_PATH, "results")
QUEUE_PATH = os.path.join(DATER_PATH, "queue")
CHECKED_PATH = os.path.join(DATER_PATH, "checked_pages")
ERROR_PATH = os.path.join(DATER_PATH, "errorlog")
DYNAMIC_DB_PATH = os.path.join(DATER_PATH, "dynamic_db")
MULTI_ORG_D_PATH = os.path.join(DATER_PATH, "multi_org_d")
LOG_PATH = os.path.join(DATER_PATH, "log_file")
ERR7_PATH = os.path.join(DATER_PATH, "jj_error_7")
PERSISTENT_PATH = os.path.join(JORB_HOME_PATH, ".persistent")
RP_PATH = os.path.join(PERSISTENT_PATH, "rp_file")
AUTO_BL_PATH = os.path.join(PERSISTENT_PATH, "auto_blacklist")
DB_TYPES = ("civ", "sch", "uni")
RP_EXPIRATION_DAYS = 180
BLACKLIST_EXPIRATION_DAYS = 60
# Timeouts
pw_req_timeout = 20000 # ms
iframe_timeout = 8
static_timeout = 8
ping_timeout = 5
bot_excluder_timeout = 5
# Scraper options
MAX_CRAWL_DEPTH = 1 # Webpage recursion depth
SEMAPHORE = 8 # Num of concurrent tasks
EMPTY_CUTOFF = 200 # Num of characters in webpage text file to be considered empty
DOMAIN_LIMIT = 20 # Max num of pages per domain
NO_RETRY_HTTP_ERROR_CODES = (403, 404, 410)
USER_AGENT_S = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" ## used for only static req?
# Exclude links that contain any of these. percent encodings must be lower case
BUNKWORDS = (
"academics",
"5il.co",
"5il%2eco",
"pnwboces.org",
"recruitfront.com",
"schoolapp.wnyric.org",
"professional development",
"career development",
"javascript:",
".pdf",
".jpg",
".ico",
".rtf",
".doc",
".mp4",
"%2epdf",
"%2ejpg",
"%2eico",
"%2ertf",
"%2edoc",
"%2emp4",
"mailto:",
"tel:",
"icon",
"description",
"specs",
"specification",
"guide",
"faq",
"images",
"exam scores",
"resume-sample",
"resume sample",
"directory",
"pupil personnel",
)
# Always skip these pages
STATIC_BLACKLIST = (
"cc.cnyric.org/districtpage.cfm?pageid=112",
"co.essex.ny.us/personnel",
"co.ontario.ny.us/94/human-resources",
"countyherkimer.digitaltowpath.org:10069/content/departments/view/9:field=services;/content/departmentservices/view/190",
"countyherkimer.digitaltowpath.org:10069/content/departments/view/9:field=services;/content/departmentservices/view/35",
"cs.monroecounty.gov/mccs/lists",
"herkimercounty.org/content/departments/view/9:field=services;/content/departmentservices/view/190",
"herkimercounty.org/content/departments/view/9:field=services;/content/departmentservices/view/35",
"jobs.albanyny.gov/default/jobs",
"monroecounty.gov/hr/lists",
"monroecounty.gov/mccs/lists",
"mycivilservice.rocklandgov.com/default/jobs",
"niagaracounty.com/employment/eligible-lists",
"ogdensburg.org/index.aspx?nid=345",
"penfield.org/multirss.php",
"tompkinscivilservice.org/civilservice/jobs",
"tompkinscivilservice.org/civilservice/jobs",
"swedishinstitute.edu/employment-at-swedish-institute",
"sunyacc.edu/job-listings",
"united.com",
)
# Include links that include any of these
# Set high and low confidence jbw lists
JBWS_ALL_HIGH = (
"continuous recruitment",
"employment",
"job listing",
"job opening",
"job posting",
"job announcement",
"job opportunities",
"job vacancies",
"jobs available",
"available positions",
"open positions",
"available employment",
"career opportunities",
"employment opportunities",
"current vacancies",
"current job",
"current employment",
"current opening",
"current posting",
"current opportunities",
"careers at",
"jobs at",
"jobs @",
"work at",
"employment at",
"find your career",
"browse jobs",
"search jobs",
"vacancy postings",
"vacancy list",
"prospective employees",
"help wanted",
"work with",
"immediate opportunities",
"promotional announcements",
)
JBWS_ALL_LOW = (
"join",
"job",
"job seeker",
"job title",
"positions",
"careers",
"human resource",
"personnel",
"vacancies",
"vacancy",
"posting",
"opening",
"recruitment",
)
JBWS_CIV_HIGH = JBWS_ALL_HIGH + (
"upcoming exam",
"exam announcement",
"examination announcement",
"examinations list",
"civil service opportunities",
"civil service exam",
"civil service test",
"current civil service",
"open competitive",
"open-competitive",
)
JBWS_CIV_LOW = JBWS_ALL_LOW + (
"open to",
"civil service",
"exam",
"examination",
"test",
"current exam",
)
JBWS_SU_HIGH = JBWS_ALL_HIGH
JBWS_SU_LOW = JBWS_ALL_LOW
JBWS_SU_X_LOW = (
"faculty",
"staff",
"adjunct",
"academic",
"support",
"instructional",
"administrative",
"professional",
"classified",
"coaching",
) ## unused third tier?
# Compile regex paterns for reducing whitespace in written files
WHITE_REG = re.compile(r"\s{2,}")
# Compile regex paterns for removing hidden HTML elements
STYLE_REG = re.compile(r"(display\s*:\s*(none|block);?|visibility\s*:\s*hidden;?)")
CLASS_REG = re.compile(
"(hidden-sections?|dropdown|has-dropdown|sw-channel-dropdown|dropdown-toggle)"
)