extractFlipkart() {
try {
const url = window.location.href;
console.log('Flipkart: Starting extraction from:', url);
// Extract Product ID
let productId = null;
// Method 1: From pid parameter
const pidMatch = url.match(/[?&]pid=([A-Z0-9]+)/i);
if (pidMatch) {
productId = pidMatch[1];
}
// Method 2: From /p/ path
if (!productId) {
const pathMatch = url.match(/\/p\/([A-Z0-9]+)/i);
if (pathMatch) {
productId = pathMatch[1];
}
}
if (!productId) {
console.error('Flipkart: Could not extract product ID');
return null;
}
console.log('✓ Flipkart: Product ID:', productId);
// Get title
let title = document.title.split(':')[0].split('|')[0].split('-')[0].trim();
if (!title || title.length < 10) {
title = 'Flipkart Product ' + productId;
}
// SCRAPE PREVIEW DATA (for popup display)
let previewPrice = null;
const priceSelectors = [
'div._30jeq3._16Jk6d',
'div._30jeq3',
'div._16Jk6d',
'div[class*="price"]'
];
for (const selector of priceSelectors) {
const priceEl = document.querySelector(selector);
if (priceEl) {
const priceText = priceEl.textContent;
const match = priceText.match(/₹([\d,]+)/);
if (match) {
previewPrice = parseFloat(match[1].replace(/,/g, ''));
console.log('Flipkart: Preview price found:', previewPrice);
break;
}
}
}
// Get preview image
const previewImages = [];
const imgSelectors = [
'img._396cs4._2amPTt',
'img[class*="product"]',
'div._1AtVbE img'
];
for (const selector of imgSelectors) {
const imgs = document.querySelectorAll(selector);
imgs.forEach(img => {
const src = img.src || img.getAttribute('data-src');
if (src && src.includes('flipkart.com') && !previewImages.includes(src)) {
const hqSrc = src.replace(/\/\d+\/\d+\//, '/800/800/');
previewImages.push(hqSrc);
}
});
if (previewImages.length > 0) break;
}
console.log('Flipkart: Preview images found:', previewImages.length);
return {
title: title,
price: previewPrice, // For preview
images: previewImages, // For preview
flipkart_product_id: productId, // For WordPress API
use_api: true, // Signal to use API
button_text: 'Buy on Flipkart',
};
} catch (error) {
console.error('Flipkart extraction error:', error);
return null;
}
}
Ant Esports KM1610 LED Gaming Keyboard and Mouse Combo, 104 Keys Rainbow Backlit Keyboard and 7 Colour RGB Mouse for PC Laptop Xbox PS4 Gamers and Work, White -
Sale!
Ant Esports KM1610 LED Gaming Keyboard and Mouse Combo, 104 Keys Rainbow Backlit Keyboard and 7 Colour RGB Mouse for PC Laptop Xbox PS4 Gamers and Work, White
【Rainbow LED Gaming Keyboard】 The rainbow LED keyboard, with rainbow backlighting and white keycaps has a highly-translucent effect, bringing you the ultimate gaming atmosphere. With a choice of static/breathing mode lights, you can also adjust the backlight brightness and breathing speed, or turn off the backlight when you don’t need it. Great for gaming or work
【High Performance Wired Keyboard】 12 multimedia keys for gaming or work efficiency. Interchangeable WASD keys and WIN lock function improves your gaming performance. With 19 anti-collision keys, no tap will be lost, ensuring smooth typing
【Ergonomic keyboard】 The light up keyboard has an ergonomic design. Curved keycaps, stepped layout, collapsible feet, and crater keys. Gives you a comfortable typing experience and improves the accuracy of keystrokes. This white wired keyboard is ideal for gaming and office work
【Wired Gaming Mouse】 The USB wired gaming mouse features a high-precision sensor and low-friction PTFE feet to give you precise and smooth control. Easily switch among four DPI (dots per inch) levels (1200 DPI/1800 DPI/2400 DPI/3600 DPI). 6 buttons (2 side buttons). Long press the DPI button to switch between 7-color breathing and red light modes
【Strong compatibility】 The gaming mouse and keyboard combo is suitable for PC, laptop, PS3, PS4, PS5, Xbox, and Mac. USB plug and play, no additional drivers required. Compatible with Windows 2000/2003/XP/Vista/Win7/Win8/Win10/Win11