@ubaidbinwaris/linkedin 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/login/login.js +41 -15
package/package.json
CHANGED
package/src/login/login.js
CHANGED
|
@@ -177,23 +177,49 @@ async function loginToLinkedIn(options = {}, credentials = null) {
|
|
|
177
177
|
return false;
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
180
|
+
if (simpleResolved) {
|
|
181
|
+
logger.info("Clicked a resolution button. Waiting to see if it clears...");
|
|
182
|
+
await randomDelay(2000, 4000);
|
|
183
|
+
if (!(await detectCheckpoint(page))) {
|
|
184
|
+
logger.info("Checkpoint resolved headlessly! Proceeding...");
|
|
185
|
+
try {
|
|
186
|
+
await page.waitForURL("**/feed**", { timeout: 10000 });
|
|
187
|
+
return { browser, context, page };
|
|
188
|
+
} catch (e) {
|
|
189
|
+
logger.warn("Resolved checkpoint but feed did not load. Continuing...");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
// Check for Mobile Verification ("Open your LinkedIn app")
|
|
194
|
+
const isMobileVerif = await page.evaluate(() => {
|
|
195
|
+
const text = document.body.innerText;
|
|
196
|
+
return text.includes("Open your LinkedIn app") ||
|
|
197
|
+
text.includes("Tap Yes on the prompt") ||
|
|
198
|
+
text.includes("verification request to your device");
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
if (isMobileVerif) {
|
|
202
|
+
logger.info("Mobile verification detected (Open App / Tap Yes).");
|
|
203
|
+
logger.info("Waiting 2 minutes for you to approve on your device...");
|
|
204
|
+
|
|
205
|
+
try {
|
|
206
|
+
// Poll for feed URL for 120 seconds
|
|
207
|
+
await page.waitForFunction(() => {
|
|
208
|
+
return window.location.href.includes("/feed") ||
|
|
209
|
+
document.querySelector('.global-nav__search');
|
|
210
|
+
}, { timeout: 120000 });
|
|
211
|
+
|
|
212
|
+
logger.info("Mobile verification successful! Resuming...");
|
|
213
|
+
return { browser, context, page };
|
|
214
|
+
} catch (err) {
|
|
215
|
+
logger.warn("Mobile verification timed out. Falling back to visible mode.");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
192
218
|
}
|
|
219
|
+
} catch (err) {
|
|
220
|
+
logger.warn(`Failed to auto-resolve checkpoint: ${err.message}`);
|
|
193
221
|
}
|
|
194
|
-
|
|
195
|
-
logger.warn(`Failed to auto-resolve checkpoint: ${err.message}`);
|
|
196
|
-
}
|
|
222
|
+
|
|
197
223
|
|
|
198
224
|
if (options.onCheckpoint && typeof options.onCheckpoint === 'function') {
|
|
199
225
|
logger.info("Triggering onCheckpoint callback...");
|