Skip to content

Commit

Permalink
Merge pull request #55 from Menighin/v3
Browse files Browse the repository at this point in the history
URL fixes
  • Loading branch information
Menighin authored Nov 22, 2021
2 parents 4fae52a + 902d40c commit b5535dd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cei-crawler",
"version": "3.0.0",
"version": "3.0.1",
"description": "Crawler para pegar dados do Canal Eletronico do Investidor",
"main": "src/app.js",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions src/lib/CeiCrawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class CeiCrawler {
console.log(`Logging at CEI using ${this.options.loginOptions.strategy}...`);

this.options.auth = await this._ceiLoginService.getToken();
console.log(JSON.stringify(this.options.auth));
this.options.lastExecutionInfo = await LastExecutionCrawler.getLastExecutionInfo();
this._isLogged = true;
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/CeiLoginService.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class CeiLoginService {
}
await homePage.reload();
} while (mainPage === null);

try {
await mainPage.waitForTimeout(4000);
await CeiUtils.retry(async () => { await mainPage.focus('#extension_DocInput'); }, 10, 1000, true);
Expand Down Expand Up @@ -94,7 +93,7 @@ class CeiLoginService {
async _getMainPage(browser) {
while (true) {
for (const p of (await browser.pages())) {
if (p.url().indexOf('b3investidor.b2clogin.com') !== -1)
if (p.url().indexOf('b3investidor.b3.com.br/b3Investidor.onmicrosoft.com') !== -1)
return p;
};
await CeiUtils.sleep(200);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/LastExecutionCrawler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const AxiosWrapper = require('./AxiosWrapper');

const URLS = {
LAST_EXECUTION: 'https://investidor.b3.com.br/api/v1/sistema/carga/ultima-execucao'
LAST_EXECUTION: 'https://investidor.b3.com.br/api/sistema/v1/carga/ultima-execucao'
};


Expand Down
8 changes: 5 additions & 3 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ test.serial('ipo-and-ipo-detail', async t => {
const ipo = await t.context.ceiCrawler.getIPOs();
t.true(ipo.paginaAtual === 1);

const id = ipo.itens[0].ofertasPublicas[0].id;
const ipoDetail = await t.context.ceiCrawler.getIPODetail(id);
t.true(ipoDetail !== undefined);
if (ipo.itens[0]) {
const id = ipo.itens[0].ofertasPublicas[0].id;
const ipoDetail = await t.context.ceiCrawler.getIPODetail(id);
t.true(ipoDetail !== undefined);
}
});

test.serial('get-stock-transactions', async t => {
Expand Down

0 comments on commit b5535dd

Please sign in to comment.