add uv files + python script to send to webhook
This commit is contained in:
+6
-6
@@ -10,7 +10,7 @@ async function fetchEntireWishlist() {
|
||||
try {
|
||||
const fileData = await fs.readFile('wishlist.json', 'utf8');
|
||||
previousWishlist = JSON.parse(fileData);
|
||||
console.log(`Loaded ${previousWishlist.length} previous items from wishlist.json for comparison.`);
|
||||
//console.log(`Loaded ${previousWishlist.length} previous items from wishlist.json for comparison.`);
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
console.log('No existing wishlist.json found. This must be the first run!');
|
||||
@@ -28,11 +28,11 @@ async function fetchEntireWishlist() {
|
||||
let hasMorePages = true;
|
||||
let pageCount = 1;
|
||||
|
||||
console.log(`\nStarting wishlist scrape for user: ${username}...`);
|
||||
//console.log(`\nStarting wishlist scrape for user: ${username}...`);
|
||||
|
||||
// 2. Scrape the current wishlist
|
||||
while (hasMorePages) {
|
||||
console.log(`Fetching page ${pageCount}...`);
|
||||
//console.log(`Fetching page ${pageCount}...`);
|
||||
|
||||
try {
|
||||
const result = await bcfetch.fan.getWishlist(currentParams);
|
||||
@@ -53,7 +53,7 @@ async function fetchEntireWishlist() {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\nDone! Successfully scraped ${allWishlistItems.length} items from your wishlist.`);
|
||||
//console.log(`\nDone! Successfully scraped ${allWishlistItems.length} items from your wishlist.`);
|
||||
|
||||
// 3. Compare the old list against the new list
|
||||
if (previousWishlist.length > 0) {
|
||||
@@ -75,14 +75,14 @@ async function fetchEntireWishlist() {
|
||||
await fs.writeFile('missing_items.json', JSON.stringify(missingItems, null, 2));
|
||||
console.log('Saved missing items to missing_items.json');
|
||||
} else {
|
||||
console.log('\nAll good! No items have disappeared since your last run.');
|
||||
//console.log('\nAll good! No items have disappeared since your last run.');
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Overwrite wishlist.json with the new, up-to-date data for the next run
|
||||
try {
|
||||
await fs.writeFile('wishlist.json', JSON.stringify(allWishlistItems, null, 2));
|
||||
console.log('Successfully updated wishlist.json with current data.');
|
||||
//console.log('Successfully updated wishlist.json with current data.');
|
||||
} catch (error) {
|
||||
console.error('Error writing to wishlist.json:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user