StiliyanKushev / csgo-tradeup-cli

A Command Line Tool for generating profitable CSGO trade-ups using the genetic algorithm.
25 stars 2 forks source link

Error when building database. Looks like a problem with the Anubis Collection #16

Closed sorenba closed 8 months ago

sorenba commented 1 year ago

I am getting this error when building database. Looks like a problem with the Anubis Collection

now scraping: Winter Offensive Weapon Case -M4A4 | Asiimov -Sawed-Off | The Kraken -AWP | Redline -M4A1-S | Guardian -P250 | Mehndi -Dual Berettas | Marina -MP9 | Rose Iron -FAMAS | Pulse -Nova | Rising Skull -Five-SeveN | Kami -PP-Bizon | Cobalt Halftone -Galil AR | Sandstorm -M249 | Magma now scraping: Anubis Collection file:///C:/Users/sba/Downloads/csgo-tradeup-cli-main/utils/rarity.js:17 rarity = rarity.toLowerCase().trim(); ^

TypeError: Cannot read properties of undefined (reading 'toLowerCase') at rarityToNumber (file:///C:/Users/sba/Downloads/csgo-tradeup-cli-main/utils/rarity.js:17:21) at gunScrape (file:///C:/Users/sba/Downloads/csgo-tradeup-cli-main/scrape.js:79:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async getGunsData (file:///C:/Users/sba/Downloads/csgo-tradeup-cli-main/scrape.js:68:47) at async updateDatabase (file:///C:/Users/sba/Downloads/csgo-tradeup-cli-main/scrape.js:277:23) at async buildDatabase (file:///C:/Users/sba/Downloads/csgo-tradeup-cli-main/db.js:41:5) at async checkEmptyDB (file:///C:/Users/sba/Downloads/csgo-tradeup-cli-main/db.js:51:9) at async file:///C:/Users/sba/Downloads/csgo-tradeup-cli-main/index.js:21:5

Node.js v18.16.0

sorenba commented 1 year ago

Maybe this is caused by ' symbol in for example P250 | Apep's Curse.

TomiLikesToCode commented 12 months ago

can it be fixed?

TomiLikesToCode commented 12 months ago

Maybe this is caused by ' symbol in for example P250 | Apep's Curse.

Man-o'-war skin has ' too

TomiLikesToCode commented 11 months ago

Maybe this is caused by ' symbol in for example P250 | Apep's Curse.

Read my open issue for detailed problem

ellysus commented 9 months ago

I did some debugging, it turns out the anubis collection link has a redirect on it.

My quick and dirty fix is adding a check on the scrape.js file on the gunScrape function:

if (url == "https://csgostash.com/collection/The+Anubis+Collection") url = "https://csgostash.com/case/378/Anubis-Collection-Package"

This fixes it for me.

StiliyanKushev commented 8 months ago

Should be fixed now. Made a small change to follow redirects when scraping.