feat: Implement Walmart scraper and integrate with existing architecture
- Added Walmart scraper to scrape product data from Walmart.com, including category pages and product details. - Introduced a stealth browser module to handle bot protection and improve scraping reliability. - Created a SQLite database for tracking product history, price changes, stock events, and user favorites. - Developed a Discord bot for user interaction, allowing location setting and stock checking at local stores. - Implemented a favorites system to manage priority products and categories with custom notification settings. - Added news aggregation module to fetch and analyze Pokemon TCG news from various sources. - Created tools for API discovery and monitoring, including a backend monitor for detecting new products. - Added unit tests for database operations, product filtering, and API endpoints to ensure functionality. - Enhanced existing modules with improved error handling and logging for better maintainability.
This commit is contained in:
@@ -1,9 +1,32 @@
|
||||
// Pokemon Stock Monitor - Content Script
|
||||
// Runs on PokemonCenter pages to extract product data
|
||||
// Runs on PokemonCenter pages to extract product data and intercept APIs
|
||||
|
||||
(function() {
|
||||
console.log("[Pokemon Monitor] Content script loaded on:", window.location.href);
|
||||
|
||||
// Inject the API interceptor into the page context
|
||||
function injectApiInterceptor() {
|
||||
const script = document.createElement('script');
|
||||
script.src = chrome.runtime.getURL('api-interceptor.js');
|
||||
script.onload = () => script.remove();
|
||||
(document.head || document.documentElement).appendChild(script);
|
||||
}
|
||||
|
||||
// Listen for messages from the injected interceptor
|
||||
window.addEventListener('message', (event) => {
|
||||
if (event.source !== window) return;
|
||||
if (event.data?.source !== 'pokemon-api-interceptor') return;
|
||||
|
||||
// Forward API data to background script
|
||||
chrome.runtime.sendMessage({
|
||||
type: 'apiData',
|
||||
data: event.data.data
|
||||
}).catch(() => {});
|
||||
});
|
||||
|
||||
// Inject the interceptor
|
||||
injectApiInterceptor();
|
||||
|
||||
// Listen for messages from background script
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message.type === "extractProducts") {
|
||||
|
||||
Reference in New Issue
Block a user