Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remake the Scraper in TS. -- Does not touch the UI. #89

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

TheMrFrick
Copy link

What's the purpose of this PR?

Fixes and remakes the scraper in Typescript.
Added additional dev_utils to read an .xlsx file of your own collection split into sheets of colors and adds the card price and the card number.

What fixes?

  • Scraper pointed to an older version of the website.

How can this be tested?

No tests were written.
All testing can be done by npm ci in the subdirectory to get the npm_modules.
Afterwards you can run the npm run start script to test the web scraper.

@TheMrFrick TheMrFrick changed the title Feature/remake to ts version feat: Remake the Scraper in TS. -- Does not touch the UI. May 22, 2022
Copy link
Contributor

@Xotl Xotl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TheMrFrick... Thanks a lot for your contribution.

I would like to merge this but seems that there're lots of files that ends on a Windows style. Can you please change those in order to end with a new line. Here's some context of the importance on doing so: https://stackoverflow.com/a/729795

*.xlsx
reworkedCards.json
reworkedCards.json_*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reworkedCards.json_*
reworkedCards.json_*

{
"docwriter.progress.trackFunctions": false,
"docwriter.progress.trackMethods": false
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

}

return result;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

era: find('dl.eraCol dd').text().trim(),
cardImageUrl: getImageUrl(find('.cardimg > img')).trim(),
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

function extractCategoryFromHref(hrefString: string): string | undefined {
const match = hrefString.match(HREF_REGEXP);
return match?.groups?.category;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}


}
console.log('programming is running');
main();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
main();
main();

// console.log(cards);
console.log(`${cards.length} cards found!`)
}
testCardScraper();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
testCardScraper();
testCardScraper();

writeFileSync(DEFAULT_OUTPUT, JSON.stringify({...(cardListJSON as any)}));
}

main();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
main();
main();

}
}

main();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
main();
main();

}

// promptUser('test');
main();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
main();
main();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants