pupgram 0.1.0 → 0.1.1
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/dist/instagram.js +4 -3
- package/package.json +1 -1
package/dist/instagram.js
CHANGED
|
@@ -12,6 +12,7 @@ const login_1 = require("./actions/login");
|
|
|
12
12
|
const needs_login_action_1 = require("./actions/needs-login.action");
|
|
13
13
|
const logger_helper_1 = require("./helpers/logger.helper");
|
|
14
14
|
const delay_action_1 = require("./actions/delay.action");
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
15
16
|
puppeteer_extra_1.default.use((0, puppeteer_extra_plugin_stealth_1.default)());
|
|
16
17
|
exports.defaultTimeout = 10000;
|
|
17
18
|
class Instagram {
|
|
@@ -60,7 +61,7 @@ class Instagram {
|
|
|
60
61
|
this.logger.info("Initalizing page");
|
|
61
62
|
const page = await this.browser.newPage();
|
|
62
63
|
await page.setViewport({ width: 1920, height: 1080 });
|
|
63
|
-
await page.goto(this.baseUrl, { waitUntil: "
|
|
64
|
+
await page.goto(this.baseUrl, { waitUntil: "domcontentloaded" });
|
|
64
65
|
this.logger.debug("Page initalized");
|
|
65
66
|
return page;
|
|
66
67
|
}
|
|
@@ -80,8 +81,8 @@ class Instagram {
|
|
|
80
81
|
}
|
|
81
82
|
catch (error) {
|
|
82
83
|
this.logger.error(error);
|
|
83
|
-
const errorsDir = "errors";
|
|
84
|
-
const currentErrorDir =
|
|
84
|
+
const errorsDir = node_path_1.default.join(process.cwd(), "errors");
|
|
85
|
+
const currentErrorDir = node_path_1.default.join(errorsDir, `error-${Date.now()}`);
|
|
85
86
|
if (this.screenshotOnError || this.htmlContentOnError) {
|
|
86
87
|
this.logger.info("Creating error directory");
|
|
87
88
|
await node_fs_1.default.promises.mkdir(currentErrorDir, { recursive: true });
|