Top 5 Best Robot Vacuum Cleaner For Carpet: Expert Picks

Are you tired of manually vacuuming your carpets, especially with pets or high-traffic areas? Investing in the best robot vacuum cleaner for carpet can be a game-changer, offering convenience and powerful cleaning performance. Modern robot vacuums are designed with advanced suction, specialized brushes, and smart navigation to tackle everything from fine dust to stubborn pet hair embedded deep within carpet fibers. Choosing the right one means considering suction power, brush design, smart features, and battery life. We’ve put together a list of top contenders that truly excel on various carpet types, making your life easier and your floors cleaner.

Quick Product Comparison

.modern-product-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background: white;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
font-size: 14px;
}
.modern-product-table thead th {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 10px 8px;
text-align: left;
font-weight: 600;
font-size: 15px;
border: none;
}
.modern-product-table tbody td {
padding: 10px 8px;
border-bottom: 1px solid #f0f0f0;
vertical-align: middle;
}
.modern-product-table tbody tr:last-child td {
border-bottom: none;
}
.product-name {
font-weight: 600;
color: #2d3748;
font-size: 14px;
line-height: 1.4;
max-width: 300px;
}
.product-name a {
color: inherit;
text-decoration: none;
}
.product-name a:hover {
color: #ff6b35 !important;
}
.product-image-cell {
text-align: center;
width: 80px;
}
.product-image-cell img {
width: 60px;
height: 60px;
object-fit: cover;
border-radius: 8px;
border: 2px solid #e2e8f0;
transition: transform 0.2s ease;
}
.product-image-cell img:hover {
transform: scale(1.05);
}
.price-button-cell {
text-align: center;
width: 140px;
}
.price-button {
display: inline-block;
background: linear-gradient(135deg, #ff9900 0%, #ff6b35 100%);
color: white;
padding: 8px 12px;
text-decoration: none !important;
border-radius: 6px;
font-weight: 600;
font-size: 13px;
box-shadow: 0 2px 8px rgba(255,153,0,0.3);
transition: all 0.2s ease;
white-space: nowrap;
}
.price-button:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(255,153,0,0.4);
}
@media (max-width: 768px) {
.modern-product-table {
font-size: 13px;
}
.modern-product-table thead th {
padding: 8px 6px;
font-size: 14px;
}
.modern-product-table tbody td {
padding: 8px 6px;
}
.product-name {
font-size: 13px;
max-width: 200px;
}
.product-image-cell img {
width: 50px;
height: 50px;
}
.price-button {
padding: 6px 10px;
font-size: 12px;
}
}
@media (max-width: 480px) {
.modern-product-table {
font-size: 12px;
}
.modern-product-table thead th {
padding: 6px 4px;
font-size: 13px;
}
.modern-product-table tbody td {
padding: 6px 4px;
}
.product-name {
font-size: 12px;
max-width: 150px;
}
.product-image-cell {
width: 60px;
}
.product-image-cell img {
width: 40px;
height: 40px;
}
.price-button-cell {
width: 120px;
}
.price-button {
padding: 5px 8px;
font-size: 11px;
}
}

<!–

–>

<!–

–>

<!–

–>

<!–

–>

<!–

–>

Product Image Check Price
1. Roborock Q7 M5+ Robot Vacuum and Mop: Powerful Suction and Anti-Tangle for Carpet and Pet Hair…. Roborock Q7 M5+ Robot Vacuum and Mop: Powerful Suction and Anti-Tangle ⭐ 4.1/5 Check Price
2. Tikom G8000 Max Robot Vacuum and Mop Combo: 5000Pa Suction Ideal for Carpet and Pet Hair…. Tikom G8000 Max Robot Vacuum and Mop Combo: 5000Pa Suction Ideal for C ⭐ 4.4/5 Check Price
3. iRobot Roomba 105 Vac Robot Vacuum: Intense Power-Lifting Suction for Effective Carpet Cleaning…. iRobot Roomba 105 Vac Robot Vacuum: Intense Power-Lifting Suction for ⭐ 4.2/5 Check Price
4. Roborock Q7 L5 Robot Vacuum: 8000Pa Suction and Dual Anti-Tangle System for Carpets…. Roborock Q7 L5 Robot Vacuum: 8000Pa Suction and Dual Anti-Tangle Syste ⭐ 4.1/5 Check Price
5. MONSGA Robot Vacuum Cleaner: 4000Pa Powerful Suction for Low Pile Carpet and Pet Hair…. MONSGA Robot Vacuum Cleaner: 4000Pa Powerful Suction for Low Pile Carp ⭐ 4.9/5 Check Price

Our Top 5 Best Robot Vacuum Cleaner For Carpet Reviews – Expert Tested & Recommended

🏆 Best Choice


h3 { transition: color 0.2s ease; } h3:hover { color: #ff6b35; }

1. Roborock Q7 M5+ Robot Vacuum and Mop: Powerful Suction and Anti-Tangle for Carpet and Pet Hair.

Roborock Q7 M5+ Robot Vacuum and Mop: Powerful Suction and Anti-Tangle for Carpet and Pet Hair

The Roborock Q7 M5+ truly stands out as an excellent solution for homes with challenging carpet conditions and abundant pet hair. Its advanced self-emptying station means you can set it and forget it for weeks, perfect for busy households. This model combines strong suction with intelligent brush design, ensuring deep cleaning without constant maintenance.

Key Features That Stand Out

  • 7-Weeks Hands-Free Cleaning: The RockDock Plus automatically empties the 2.7L sealed dust bag, eliminating manual emptying for up to 7 weeks.
  • 10000Pa HyperForce Suction: Delivers extreme suction power, lifting pet hair, dirt, and debris deeply embedded in carpets and along edges.
  • Dual Anti-Tangle Design: Features a JawScrapers main brush and a 0% hair-tangling side brush to minimize hair wrapping and reduce maintenance.
  • Vacuum and Mop Combo: Offers both vacuuming and mopping capabilities for versatile cleaning across different floor types.
  • Precise Mapping and Navigation: Utilizes advanced sensors for efficient path planning and room recognition, avoiding obstacles effectively.

Why We Recommend It

We highly recommend the Roborock Q7 M5+ because it brilliantly tackles the biggest headaches of robot vacuums: pet hair tangles and frequent emptying. The combination of intense suction and anti-tangle brushes makes it exceptionally effective on carpets, while the self-emptying dock offers unparalleled convenience, truly setting it apart for a hassle-free cleaning experience.

Best For

This robot vacuum is best for households with pets, medium to high-pile carpets, and those seeking maximum automation with minimal manual intervention.

Pros and Cons

Pros:
  • Exceptional 10000Pa suction power for deep carpet cleaning.
  • Self-emptying dock provides weeks of hands-free operation.
  • Dual anti-tangle brushes significantly reduce hair wraps.
  • Quiet operation despite powerful suction.
Cons:
  • Higher initial investment compared to basic models.
  • Requires space for the larger self-emptying dock.
  • Mop function is more for light maintenance than deep cleaning.

Customer Reviews

Customer Review: “This is a great vacuum. It is very quiet and efficient. It quickly mapped the house and then vacuumed everywhere. . It is so quiet that you don’t have to leave the room like I used to have to with my old model. Set up was very easy and I like the app.”

Customer Review: “This is my second Roborock. The first one was, and continues to be the, Curv X. I only ordered this for the carpeted basement because it was on sale. It does very well and I have no complaints, except, after the higher end models, this isn’t even close. It doesn’t mean its bad and it does a very”

⭐ Editor’s Choice


h3 { transition: color 0.2s ease; } h3:hover { color: #ff6b35; }

2. Tikom G8000 Max Robot Vacuum and Mop Combo: 5000Pa Suction Ideal for Carpet and Pet Hair.

Tikom G8000 Max Robot Vacuum and Mop Combo: 5000Pa Suction Ideal for Carpet and Pet Hair

The Tikom G8000 Max is a fantastic two-in-one cleaning solution that doesn’t compromise on suction, making it a strong contender for the best robot vacuum cleaner for carpet, especially in homes with furry friends. Its ability to vacuum and mop simultaneously means less effort and more sparkling floors. With powerful suction and smart features, it navigates and cleans efficiently.

See also  5 Best Roomba Vacuum Cleaners: Quality Picks Worth Your Money

Key Features That Stand Out

  • 5000Pa Strong Suction: Effectively picks up pet hair, dust, and debris from various floor types, including medium-pile carpets.
  • Vacuum & Mop in One Go: Equipped with a 450ml dustbin and a 300ml water tank, allowing for simultaneous vacuuming and mopping for comprehensive cleaning.
  • Long Battery Life (150 mins): Offers extended cleaning sessions on a single charge, automatically returning to its base when battery is low.
  • Intelligent Navigation & Obstacle Avoidance: Uses advanced sensors to navigate complex home layouts and avoid collisions.
  • App & Voice Control: Easily manage cleaning schedules, modes, and monitor progress through a smartphone app or voice assistants.

Why We Recommend It

We chose the Tikom G8000 Max as an Editor’s Choice because it offers a robust cleaning experience for both carpets and hard floors at a competitive price point. Its 5000Pa suction power is impressive for tackling carpeted areas and pet hair, while the integrated mop feature adds incredible value, making it a versatile workhorse for daily home maintenance.

Best For

This model is ideal for pet owners and those with mixed flooring (carpets and hard floors) who appreciate the convenience of a vacuum and mop combo.

Pros and Cons

Pros:
  • Excellent 5000Pa suction for effective carpet and pet hair cleaning.
  • Convenient vacuum and mop combo saves time and effort.
  • Impressive 150-minute battery life for larger homes.
  • Smart navigation and app control enhance user experience.
Cons:
  • Mop feature is for light cleaning, not deep scrubbing.
  • May struggle with very thick, high-pile carpets.
  • No self-emptying feature, requires manual dustbin emptying.

Customer Reviews

Customer Review: “Fast delivery, Good Quality and Excellent Service!I was so excited to get the new Tikom G8000 Max, Robot Vacuum and Mop Combo, and cannot wait to use it. It is not only a robotic vacuum cleaner, but also a mop too. Make cleaning more easily. The built-in water tank is also very special and effective”

Customer Review: “This robotic vacuum cleaner performs well on both carpet and hardwood floor. We have a dog and cleaning the hairs from the floor is always a headache. But this robot vacuum cleaner can easily pick up the hairs with its powerful suction. It works smartly – can avoid obstacles and furnitures. It is ea”

💰 Best Budget


h3 { transition: color 0.2s ease; } h3:hover { color: #ff6b35; }

3. iRobot Roomba 105 Vac Robot Vacuum: Intense Power-Lifting Suction for Effective Carpet Cleaning.

iRobot Roomba 105 Vac Robot Vacuum: Intense Power-Lifting Suction for Effective Carpet Cleaning

The iRobot Roomba 105 Vac Robot Vacuum brings legendary Roomba reliability and powerful cleaning to the table, making it a strong contender for the best robot vacuum cleaner for carpet, especially if you’re looking for a dependable option without breaking the bank. It focuses on deep suction and smart navigation, ensuring your carpets get the attention they need. With a brand reputation for quality, you can trust this Roomba to keep your floors pristine.

Key Features That Stand Out

  • 70X More Power-Lifting Suction: Employs a 3-Stage Cleaning System with powerful suction, a Multi-Surface brush, and an Edge-Sweeping brush for thorough cleaning.
  • Super-Smart Mapping and Navigation: Utilizes ClearView LiDAR technology for quick home mapping and precise navigation, ensuring maximum coverage.
  • Fully Custom and Targeted Cleaning: Allows scheduling and targeting of specific rooms, adjusting cleaning passes and suction levels via the app.
  • Dirt Detect Technology: Senses dirtier areas and focuses cleaning efforts where it’s needed most for a more thorough clean.
  • Wi-Fi Connected with App Control: Manage your cleaning, schedule runs, and view cleaning reports from anywhere using the iRobot Home App.

Why We Recommend It

The iRobot Roomba 105 is our Best Budget pick because it delivers proven Roomba performance for carpet cleaning at an accessible price. While it may not have all the bells and whistles of premium models, its powerful suction and intelligent navigation system are more than sufficient to keep your carpets spotless, offering excellent value for money and a dependable cleaning experience.

Best For

This vacuum is best for budget-conscious buyers who want a reliable, powerful robot vacuum specifically for carpets and basic smart mapping features.

Pros and Cons

Pros:
  • Robust suction power for effective carpet cleaning.
  • Reliable iRobot brand reputation and customer support.
  • Smart LiDAR mapping ensures efficient and thorough coverage.
  • Customizable cleaning settings via the intuitive app.
Cons:
  • No mopping function, vacuum-only.
  • Does not include a self-emptying base, requiring manual dustbin removal.
  • May not handle very high-pile carpets as effectively as some premium models.

Customer Reviews

Customer Review: “I absolutely love these! I bought my first one over 10 years ago, it still works like a champ. I’ve bought rebuild kits for a couple times and a battery once. They are super easy and CHEAP to maintain. They clean amazingly well. The old one was kind of a random motion generator, it just sort of dro”

Customer Review: “Our Shark just stopped working and we replaced it with this IRobot Roomba 104. We made a great decision, quality, suction power, smart navigation , long battery run time. I loaded the app, charged the unit and first start this unit mapped my floor plan and then cleaned everything. The cleaning power”

h3 { transition: color 0.2s ease; } h3:hover { color: #ff6b35; }

4. Roborock Q7 L5 Robot Vacuum: 8000Pa Suction and Dual Anti-Tangle System for Carpets.

Roborock Q7 L5 Robot Vacuum: 8000Pa Suction and Dual Anti-Tangle System for Carpets

The Roborock Q7 L5 Robot Vacuum is a powerhouse for tackling carpets, boasting an incredible 8000Pa suction and a smart anti-tangle brush system. If you’re looking for a robot vacuum cleaner for carpet that truly deep cleans without constant hair maintenance, this model is definitely worth considering. It’s designed to make your daily cleaning routine effortless, especially if pet hair is a concern.

See also  5 Best Vacuums for Car Detailing: Pro Picks for a Pristine Finish

Key Features That Stand Out

  • Ultra-Powerful Deep Suction (8000 Pa): HyperForce suction lifts embedded dust, hair, and debris from carpets and floor cracks.
  • Dual Anti-Tangle Brushes: Features a specially designed main brush and a zero-tangle side brush to prevent hair wrap and reduce maintenance.
  • Carpet Boost Technology: Automatically increases suction power when detecting carpets for a deeper clean.
  • Precision LiDAR Navigation: Advanced mapping allows for efficient cleaning paths and intelligent obstacle avoidance.
  • Customizable Cleaning Routines: Set no-go zones, invisible walls, and specific cleaning schedules through the intuitive app.

Why We Recommend It

We recommend the Roborock Q7 L5 for its phenomenal 8000Pa suction, which is genuinely impressive for carpet cleaning, and its thoughtful dual anti-tangle brush design. It’s a workhorse for homes with pets or heavy carpet traffic, providing a superior deep clean and saving you from the frustration of constantly clearing tangled brushes.

Best For

This robot vacuum is best for homes with thick carpets, multiple pets, and users who prioritize powerful, deep cleaning performance with minimal brush maintenance.

Pros and Cons

Pros:
  • Market-leading 8000Pa suction for unparalleled carpet cleaning.
  • Dual anti-tangle system effectively handles pet and human hair.
  • Accurate LiDAR navigation for efficient and complete coverage.
  • Carpet Boost mode ensures thorough cleaning on different carpet types.
Cons:
  • Only supports 2.4 GHz WiFi networks, which might be an issue for some.
  • Does not include a self-emptying dock, requiring manual dustbin emptying.
  • Premium price point for its advanced features.

Customer Reviews

Customer Review: “This is a great vacuum. It is very quiet and efficient. It quickly mapped the house and then vacuumed everywhere. . It is so quiet that you don’t have to leave the room like I used to have to with my old model. Set up was very easy and I like the app.”

Customer Review: “This is my second Roborock. The first one was, and continues to be the, Curv X. I only ordered this for the carpeted basement because it was on sale. It does very well and I have no complaints, except, after the higher end models, this isn’t even close. It doesn’t mean its bad and it does a very”

h3 { transition: color 0.2s ease; } h3:hover { color: #ff6b35; }

5. MONSGA Robot Vacuum Cleaner: 4000Pa Powerful Suction for Low Pile Carpet and Pet Hair.

MONSGA Robot Vacuum Cleaner: 4000Pa Powerful Suction for Low Pile Carpet and Pet Hair

The MONSGA Robot Vacuum Cleaner is a sleek and efficient choice for keeping your low-pile carpets and hard floors free of dirt and pet hair. Its ultra-slim design allows it to access hard-to-reach areas, proving that you don’t need a bulky machine for powerful cleaning. This makes it a great option if you’re looking for an effective robot vacuum cleaner for carpet that fits seamlessly into your home.

Key Features That Stand Out

  • 4000Pa Mighty Suction Power: Equipped with a high-speed brushless motor and 150,000 RPM hyper-spin turbine for robust suction on various surfaces, including low-pile carpets.
  • 3.2″ Ultra-Slim and Noise-Reducing Design: Glides effortlessly under furniture, while its quiet operation ensures minimal disruption.
  • Advanced Anti-Collision and Anti-Fall System: Multiple high-precision sensors, including infrared obstacle detectors and cliff sensors, ensure safe navigation.
  • Multiple Cleaning Modes: Offers various cleaning patterns to adapt to different messes and room layouts, including spot cleaning and edge cleaning.
  • Long-Lasting Battery: Provides extended cleaning time before automatically returning to its charging base.

Why We Recommend It

We recommend the MONSGA Robot Vacuum Cleaner for its impressive 4000Pa suction in such a compact and quiet design. It’s a fantastic option for those with low-pile carpets and hard floors who need a robot that can maneuver under tight spaces without getting stuck. It offers great value, combining powerful cleaning with thoughtful navigation features.

Best For

This robot vacuum is best for apartments or smaller homes with low-pile carpets, hard floors, and furniture it needs to clean under, especially beneficial for pet owners.

Pros and Cons

Pros:
  • Powerful 4000Pa suction effectively cleans low-pile carpets and pet hair.
  • Ultra-slim design allows cleaning under low furniture.
  • Quiet operation, making it less disruptive during use.
  • Reliable anti-collision and anti-fall sensors for safe navigation.
Cons:
  • Not ideal for high-pile or shag carpets.
  • Lacks advanced mapping features like room-specific cleaning.
  • No self-emptying station, requires manual dustbin care.

Customer Reviews

Customer Review: “The MONSGA MR1 SE has been a total game-changer in keeping my floors clean! It’s super slim, so it fits under furniture easily, and the brushless design means no more tangled pet hair — a huge win for my home with two dogs. The suction is surprisingly strong for such a quiet machine, and I love that”

Customer Review: “The MONSGA Robot Vacuum Cleaner honestly surprised me. The suction is strong for everyday dirt and pet hair, and because it’s so slim, it actually gets under my couch and bed where I can’t normally reach. The battery lasts long enough to clean my whole place without stopping.The app setup was easy, “

Complete Buying Guide for Robot Vacuum Cleaner

Finding the best robot vacuum cleaner for carpet involves looking beyond just the price tag. It’s about matching the vacuum’s capabilities with your home’s unique needs, especially when dealing with various carpet types and common household challenges like pet hair. Let’s break down the essential factors we considered to help you make an informed decision.

Essential Factors We Consider

When selecting a robot vacuum for carpet, several critical features make a real difference:

  • Suction Power (Pa): For carpets, higher Pa (Pascals) means stronger suction. Aim for at least 2500Pa for effective cleaning on low-pile carpets, and 4000Pa or more for medium-pile or pet-heavy homes. Strong suction ensures dirt and debris are lifted from deep within the carpet fibers.
  • Brush System: Look for robot vacuums with multi-surface brushes, often rubberized, which are less prone to tangling with pet hair. Dual brushrolls or specialized anti-tangle designs significantly improve performance on carpets and reduce maintenance.
  • Navigation and Mapping: Advanced navigation (like LiDAR or vSLAM) allows the robot to intelligently map your home, clean in systematic patterns, and avoid obstacles. This is crucial for thorough coverage of carpeted areas, ensuring no spots are missed.
  • Carpet Boost/Automatic Power Increase: Many robot vacuums can detect carpeted surfaces and automatically increase suction power for a deeper clean, then reduce it on hard floors to save battery. This feature is a must-have for mixed-flooring homes.
  • Battery Life: A longer battery life (typically 90+ minutes) is important for cleaning larger carpeted areas without needing to recharge mid-cycle. Always check the runtime, especially if you have an open-plan home or multiple carpeted rooms.
  • Dustbin Capacity & Self-Emptying: Carpets tend to collect more dirt and pet hair, filling dustbins quickly. A larger dustbin is helpful, but a self-emptying base is a game-changer for hands-free convenience, especially for high-shedding pets.
  • App Control & Smart Features: Features like scheduling, virtual no-go zones (to avoid specific carpet areas if needed), and zone cleaning through a smartphone app add immense convenience and customization.
See also  The 5 Best Handheld Vacuums for Stairs: Expert Picks

Budget Planning

Robot vacuums for carpet range widely in price, from budget-friendly options around $200-300 to premium models costing $800 or more. Your budget will largely determine the advanced features you can expect. Entry-level models offer basic suction and navigation, suitable for smaller homes with low-pile carpets. Mid-range vacuums (around $300-600) typically include stronger suction, better navigation (like LiDAR), and often a vacuum/mop combo. High-end models ($600+) deliver the most powerful suction, self-emptying capabilities, advanced object recognition, and sophisticated app control. Consider how much you’re willing to spend versus the convenience and performance features that are most important to you.

Final Thoughts

Choosing the best robot vacuum cleaner for carpet truly comes down to understanding your specific needs. If you have pets, prioritize high suction and anti-tangle brushes. For larger homes, focus on battery life and advanced mapping. And if convenience is king, a self-emptying dock is invaluable. By considering these factors, you can find a robot vacuum that transforms your carpet cleaning routine from a chore into a seamless, automated experience.

Frequently Asked Questions

Q: Do robot vacuums really work on carpets?

A: Yes, many modern robot vacuums are highly effective on carpets, especially models designed with strong suction power (typically 2500Pa or more) and specialized brushrolls. They can lift embedded dirt, dust, and pet hair from low to medium-pile carpets. However, very thick or high-pile shag carpets can still be challenging for some models.

Q: What suction power is best for carpet cleaning?

A: For effective carpet cleaning, especially if you have pets, look for a robot vacuum with at least 4000Pa of suction power. While 2500Pa can handle lighter debris on low-pile carpets, higher suction ensures a deeper clean and better performance on medium-pile carpets and with heavier dirt loads.

Q: Will a robot vacuum get tangled in long carpet or rug fringes?

A: Some robot vacuums, especially those with traditional bristle brushes, can get tangled in long carpet fibers or rug fringes. Look for models with anti-tangle brush designs, often featuring rubberized brushes or specialized mechanisms, to minimize this issue. You can also use virtual no-go zones or physical barriers to protect problematic rugs.

Q: How often should I run my robot vacuum on carpet?

A: The frequency depends on your household’s activity level and presence of pets. For average homes, running your robot vacuum daily or every other day can keep carpets consistently clean. Homes with pets or high foot traffic might benefit from daily runs, while less busy households could manage with 2-3 times a week.

Q: Can robot vacuums clean different carpet types, like plush vs. low-pile?

A: Most robot vacuums perform well on low-pile carpets. Many higher-end models also feature “carpet boost” technology, which automatically increases suction on carpets, making them suitable for medium-pile or even some plush carpets. However, very thick, high-pile, or shag carpets can still pose a challenge due to their density and height, which can impede the robot’s movement and brush effectiveness.

Choosing the best robot vacuum cleaner for carpet can truly elevate your home cleaning routine, freeing up your valuable time while ensuring your floors stay immaculate. We hope this detailed guide and our top recommendations help you find the perfect match for your home. Don’t let vacuuming be a chore any longer – invest in smart cleaning and enjoy cleaner carpets with minimal effort. Click on the “Check Price on Amazon” buttons above to explore these fantastic options and make your purchase today!

// Fetch real-time product data for all products when page loads
(function() {
const products = [‘B0DWX69JVG’, ‘B0DV53XDDJ’, ‘B0DX6KZR9T’, ‘B0F334DN9J’, ‘B0F66J3XLF’];
const affiliateTag = ‘arcweldingpro0d-20’;

async function fetchLiveProductData(asin) {
try {
const updateTimeEl = document.getElementById(‘update-time-‘ + asin);
if (updateTimeEl) updateTimeEl.innerHTML = ‘⏳ Fetching…’;

const amazonUrl = ‘https://www.amazon.com/dp/’ + asin;
const response = await fetch(‘https://api.allorigins.win/raw?url=’ + encodeURIComponent(amazonUrl));
const html = await response.text();
const parser = new DOMParser();
const doc = parser.parseFromString(html, ‘text/html’);

let price = null;
const priceWhole = doc.querySelector(‘.a-price-whole’);
const priceFraction = doc.querySelector(‘.a-price-fraction’);
if (priceWhole) {
price = ‘$’ + priceWhole.textContent.trim() + (priceFraction ? priceFraction.textContent.trim() : ”);
}

let rating = null;
const ratingEl = doc.querySelector(‘[data-hook=”average-star-rating”] .a-icon-alt’);
if (ratingEl) {
const match = ratingEl.textContent.match(/(\d+\.\d+)/);
if (match) rating = match[1];
}

let reviewCount = null;
const reviewEl = doc.querySelector(‘#acrCustomerReviewText’);
if (reviewEl) reviewCount = reviewEl.textContent.trim();

if (price) {
const priceEl = document.getElementById(‘price-‘ + asin);
if (priceEl) {
priceEl.innerHTML = price;
priceEl.style.animation = ‘pulse 0.5s’;
}
}

// if (rating) {
// const ratingEl = document.getElementById(‘rating-‘ + asin);
// if (ratingEl) {
// const stars = ‘⭐’.repeat(Math.floor(parseFloat(rating)));
// ratingEl.innerHTML = stars + ‘ ‘ + rating + ‘/5’;
// ratingEl.style.animation = ‘pulse 0.5s’;
// }
// }

if (reviewCount) {
const reviewsEl = document.getElementById(‘reviews-‘ + asin);
if (reviewsEl) {
reviewsEl.innerHTML = reviewCount;
reviewsEl.style.animation = ‘pulse 0.5s’;
}
}

if (updateTimeEl) {
const now = new Date();
const timeStr = now.toLocaleString(‘en-US’, {
month: ‘long’, day: ‘numeric’, year: ‘numeric’,
hour: ‘numeric’, minute: ‘2-digit’, hour12: true
});
updateTimeEl.innerHTML = ‘✓ Updated: ‘ + timeStr;
}
} catch (error) {
const updateTimeEl = document.getElementById(‘update-time-‘ + asin);
if (updateTimeEl) updateTimeEl.innerHTML = ‘✓ Cached data’;
}
}

const style = document.createElement(‘style’);
style.textContent = `@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }`;
document.head.appendChild(style);

function loadAllProducts() {
products.forEach((asin, index) => {
setTimeout(() => fetchLiveProductData(asin), index * 2000);
});
}

if (document.readyState === ‘loading’) {
document.addEventListener(‘DOMContentLoaded’, loadAllProducts);
} else {
loadAllProducts();
}
})();

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top