Skip to content

Commit

Permalink
fixing aram
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloendoh committed Jun 3, 2024
1 parent 0f30200 commit 8cf9438
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 331 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ export class _CacheLolGraphAramStats {
60 * 60 * 24 // 1 day
)

await browser.close()

return x

// let html = ""
Expand Down
11 changes: 0 additions & 11 deletions src/malLoop.ts

This file was deleted.

7 changes: 5 additions & 2 deletions src/utils/lolrates/scrapeLolRates/scrapeAram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export async function scrapeAram(page: Page) {
try {
let aramResults: AramChampionData[] = []

await page.goto(`https://www.op.gg/modes/aram`)
await page.goto(`https://www.op.gg/modes/aram`, {
waitUntil: "load",
timeout: 0,
})

await page.waitForSelector("tbody")
await sleep(500) // waiting for champions sort
Expand All @@ -29,7 +32,7 @@ export async function scrapeAram(page: Page) {
const tds = tr.querySelectorAll("td")
const championTd = tds[1]
const championName =
championTd?.querySelector("strong")?.textContent || ""
championTd?.querySelector("strong")?.textContent ?? ""
const winRate = tds[3].innerText

roleResults.push({
Expand Down
10 changes: 5 additions & 5 deletions src/utils/lolrates/scrapeLolRates/scrapeOpgg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ export async function scrapeOpgg(page: Page) {

const roleResults: IOpggResult[] = []
const tbody = document.querySelector("tbody")
const trs = Array.from(tbody?.querySelectorAll("tr") || [])
const trs = Array.from(tbody?.querySelectorAll("tr") ?? [])

for (const tr of trs) {
const tds = tr.querySelectorAll("td")
const championTd = tds[1]
const championName =
championTd?.querySelector("strong")?.textContent || ""
const winRate = tds[3].innerText
const pickRate = tds[4].innerText
championTd?.querySelector("strong")?.textContent ?? ""
const winRate = tds[4].innerText
const pickRate = tds[5].innerText

roleResults.push({
role: getRole(),
Expand All @@ -72,7 +72,7 @@ export async function scrapeOpgg(page: Page) {
)
}

const saved = await LolRateRepository.saveOpgg(allRolesResults)
await LolRateRepository.saveOpgg(allRolesResults)
myConsoleSuccess(`OP GG OK: ${allRolesResults.length} results`)

return
Expand Down
30 changes: 0 additions & 30 deletions src/utils/mal/scrapeMal.ts

This file was deleted.

88 changes: 0 additions & 88 deletions src/utils/mal/scrapeMalUser/scrapeMalUser.ts

This file was deleted.

This file was deleted.

114 changes: 0 additions & 114 deletions src/utils/mal/scrapeMalUser/scrapeUser/scrapeUser.ts

This file was deleted.

0 comments on commit 8cf9438

Please sign in to comment.