Commented checkup out and Prostor fetch changed.
This commit is contained in:
@@ -4,6 +4,7 @@ const fetch = require("../../helpers/fetchWrapper");
|
|||||||
const cheerio = require("cheerio");
|
const cheerio = require("cheerio");
|
||||||
const moment = require("moment-timezone");
|
const moment = require("moment-timezone");
|
||||||
const FormData = require("form-data");
|
const FormData = require("form-data");
|
||||||
|
const nodeFetch = require("node-fetch");
|
||||||
|
|
||||||
const {
|
const {
|
||||||
AD_TYPE,
|
AD_TYPE,
|
||||||
@@ -197,7 +198,7 @@ class ProstorCrawler {
|
|||||||
|
|
||||||
// console.log("[PROSTOR] Scraping : ", url);
|
// console.log("[PROSTOR] Scraping : ", url);
|
||||||
try {
|
try {
|
||||||
const adPageSource = await fetch(url, {
|
const adPageSource = await nodeFetch(url, {
|
||||||
headers: { Cookie: prostorCookie }
|
headers: { Cookie: prostorCookie }
|
||||||
});
|
});
|
||||||
const body = await adPageSource.text();
|
const body = await adPageSource.text();
|
||||||
@@ -427,7 +428,7 @@ class ProstorCrawler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(url, {
|
const res = await nodeFetch(url, {
|
||||||
headers: { Cookie: prostorCookie }
|
headers: { Cookie: prostorCookie }
|
||||||
});
|
});
|
||||||
const body = await res.text();
|
const body = await res.text();
|
||||||
@@ -591,7 +592,7 @@ class ProstorCrawler {
|
|||||||
formData.append("email", PROSTOR_LOGIN.EMAIL);
|
formData.append("email", PROSTOR_LOGIN.EMAIL);
|
||||||
formData.append("password", PROSTOR_LOGIN.PASSWORD);
|
formData.append("password", PROSTOR_LOGIN.PASSWORD);
|
||||||
|
|
||||||
return fetch("https://prostor.ba/moj-prostor/prijava", {
|
return nodeFetch("https://prostor.ba/moj-prostor/prijava", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
headers: { Cookie: prostorCookie }
|
headers: { Cookie: prostorCookie }
|
||||||
@@ -618,9 +619,12 @@ class ProstorCrawler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
async getCookies() {
|
async getCookies() {
|
||||||
const getResponse = await fetch("https://prostor.ba/moj-prostor/prijava", {
|
const getResponse = await nodeFetch(
|
||||||
headers: { Cookie: "" }
|
"https://prostor.ba/moj-prostor/prijava",
|
||||||
});
|
{
|
||||||
|
headers: { Cookie: "" }
|
||||||
|
}
|
||||||
|
);
|
||||||
const raw = getResponse.headers.raw()["set-cookie"];
|
const raw = getResponse.headers.raw()["set-cookie"];
|
||||||
const cookie = raw
|
const cookie = raw
|
||||||
.map(datastring => {
|
.map(datastring => {
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ const notifyRequestsWithDailyOption = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const checkUpNotify = async () => {
|
const checkUpNotify = async () => {
|
||||||
const searchRequestsForCheckUp = await findAllRequestsForCheckUp();
|
/* const searchRequestsForCheckUp = await findAllRequestsForCheckUp();
|
||||||
|
|
||||||
const asyncSendEmailActions = [];
|
const asyncSendEmailActions = [];
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ const checkUpNotify = async () => {
|
|||||||
searchRequest.notifiedAt = new Date();
|
searchRequest.notifiedAt = new Date();
|
||||||
searchRequest.save();
|
searchRequest.save();
|
||||||
}
|
}
|
||||||
await Promise.all(asyncSendEmailActions);
|
await Promise.all(asyncSendEmailActions);*/
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
Reference in New Issue
Block a user