5 Best Vacuum for Carpeted Stairs: Our Top Picks for Superior Clean

Cleaning carpeted stairs can be a real hassle with a bulky upright vacuum. It’s an awkward, time-consuming chore that often leaves behind stubborn dirt and pet hair. But don’t worry, finding the best vacuum for carpeted stairs doesn’t have to be a struggle! We’ve scoured the market to find lightweight, powerful, and easy-to-use options designed specifically for those tricky nooks and crannies. Whether you’re battling persistent pet dander or just want to keep your home pristine, our expert-tested recommendations will help you glide through stair cleaning with ease. Get ready to discover the perfect tool that makes this chore feel less like a workout and more like a breeze!

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. Eureka WhirlWind Bagless Canister Vacuum. Lightweight for Carpeted Stairs and Hard Floors…. Eureka WhirlWind Bagless Canister Vacuum. Lightweight for Carpeted Sta ⭐ 4.2/5 Check Price
2. BISSELL Pet Hair Eraser Cordless Hand Vacuum. Ideal for Pet Hair on Stairs and Upholstery…. BISSELL Pet Hair Eraser Cordless Hand Vacuum. Ideal for Pet Hair on St ⭐ 4.5/5 Check Price
3. BLACK+DECKER dust buster Cordless Handheld Pet Vacuum. Portable for Stairs with Powerful Suction and… BLACK+DECKER dust buster Cordless Handheld Pet Vacuum. Portable for St ⭐ 4.1/5 Check Price
4. Cordless Pet Hair Handheld Vacuum. High Power with Motorized Brush, LED Light, and Reusable Filter…. Cordless Pet Hair Handheld Vacuum. High Power with Motorized Brush, LE ⭐ 4.7/5 Check Price
5. Shark UltraCyclone Pet Pro Plus Cordless Hand Vacuum. Powerful Suction for Stairs with Pet Power Bru… Shark UltraCyclone Pet Pro Plus Cordless Hand Vacuum. Powerful Suction ⭐ 4.2/5 Check Price

Our Top 5 Best Vacuum For Carpeted Stairs Reviews – Expert Tested & Recommended

🏆 Best Choice


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

1. Eureka WhirlWind Bagless Canister Vacuum. Lightweight for Carpeted Stairs and Hard Floors.

Eureka WhirlWind Bagless Canister Vacuum. Lightweight for Carpeted Stairs and Hard Floors.

The Eureka WhirlWind Bagless Canister Vacuum is a fantastic contender for the best vacuum for carpeted stairs, offering surprising power in a remarkably lightweight package. This innovative multi-surface vacuum is designed for deep cleaning, easily transitioning from carpets to hard floors with integrated airflow control right on the handle. Weighing in at just 8.15 pounds, it’s incredibly easy to carry up and down stairs, maneuver around furniture, and store away when you’re done.

Key Features That Stand Out

  • ✓ Integrated airflow control on the handle for seamless multi-surface cleaning.
  • ✓ Exceptionally lightweight (only 8.15 lbs) for easy portability and maneuverability.
  • ✓ Large 2.5L bagless dust container minimizes frequent emptying.
  • ✓ Features washable filters, eliminating ongoing maintenance costs for bags and filters.

Why We Recommend It

This canister vacuum offers surprising power for its lightweight design, making it a great choice for tackling carpeted stairs and various other surfaces in your home. Its bagless design and washable filters also simplify maintenance, adding to its overall convenience and value. It truly makes the chore of vacuuming stairs much less daunting.

Best For

Homeowners looking for a versatile, lightweight vacuum for carpeted stairs and hard floors who appreciate easy maintenance and strong suction without the bulk.

Pros and Cons

Pros:
  • Very lightweight and easy to carry up and down stairs.
  • Strong suction suitable for both carpets and hard floors.
  • Bagless design with washable filters for significant cost savings.
  • Integrated airflow control allows for versatile cleaning on different surfaces.
  • Compact size makes it easy to store in smaller spaces.
Cons:
  • Corded operation might be less convenient than cordless for extensive stair cleaning.
  • Canister design requires pulling the unit behind you, which can be an adjustment.
  • May not include specialized pet hair attachments found in other models.

Customer Reviews

Customer Review: “I love it!!!! It works just like it says. Well made! I needed a vacuum that could get under my furniture, bed etc. I don’t have too many rugs. I have an upright vacuum but it wasn’t sufficient even with attachments. I didn’t like the stick vacuums with the big clunky thing at the top. It also had to”

Customer Review: “I have owned some really expensive vacuums. Those vacuums do a great job. This vacuum has learned from the super expensive brands. The best parts are that it’s bagless and lightweight. You can easily take this vacuum throughout the house to get the job done.I am able to easily vacuum under my furnit”

⭐ Editor’s Choice


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

2. BISSELL Pet Hair Eraser Cordless Hand Vacuum. Ideal for Pet Hair on Stairs and Upholstery.

BISSELL Pet Hair Eraser Cordless Hand Vacuum. Ideal for Pet Hair on Stairs and Upholstery.

For pet parents, the BISSELL Pet Hair Eraser Cordless Hand Vacuum is an absolute game-changer, especially when tackling that never-ending pet hair on carpeted stairs. This powerful handheld vacuum is specifically engineered for pet hair, featuring a motorized brush tool that digs deep to remove embedded dirt and fur from stairs and upholstery. Its cordless convenience, powered by a 14V lithium-ion battery, means you can clean wherever you need without being tethered to an outlet.

See also  5 Best Hardwood Carpet Vacuums: Expert Reviews & Top Picks

Key Features That Stand Out

  • ✓ Motorized brush tool designed specifically for removing embedded dirt and pet hair.
  • ✓ Cordless operation with a 14V lithium-ion battery for ultimate freedom and portability.
  • ✓ Lightweight and easy to maneuver, making it perfect for stairs, upholstery, and car interiors.
  • ✓ Every purchase supports the BISSELL Pet Foundation, helping save pets in need.

Why We Recommend It

For pet owners, this Bissell handheld vacuum is a godsend, especially when dealing with pet hair on carpeted stairs. The specialized motorized brush is highly effective at lifting stubborn fur, and its cordless design offers unparalleled convenience, allowing you to quickly clean up messes without any hassle.

Best For

Pet owners seeking a dedicated, cordless handheld vacuum for effectively removing pet hair from stairs, upholstery, and car interiors, while also supporting a good cause.

Pros and Cons

Pros:
  • Excellent at picking up pet hair, thanks to the targeted motorized brush.
  • Cordless design provides maximum flexibility and ease of use for stair cleaning.
  • Lightweight and easy to handle for quick cleanups and spot treatment.
  • Offers reliable power with its 14V lithium-ion battery.
  • Supports a charitable cause (BISSELL Pet Foundation) with every purchase.
Cons:
  • Battery life may be limited for extensive, whole-house cleaning sessions.
  • Smaller dustbin requires more frequent emptying compared to full-size vacuums.
  • Suction is optimized for pet hair, potentially making it less versatile for other types of debris.

Customer Reviews

Customer Review: “The BISSELL Pet Hair Eraser Cordless Hand Vacuum has been a big help around my home and car. It’s lightweight, easy to maneuver, and the battery lasts long enough to clean furniture and small messes without constantly recharging. The suction is strong for a handheld, and it does a great job pulling “

Customer Review: “I love this handheld vacuum! I have two long-haired cats and a German Shepherd so everything I own is always covered in fur. This vacuum is very convenient to spot clean areas where fur has built up or to clean up loose litter around the litter box. It has great suction and will pick up just about a”

💰 Best Budget


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

3. BLACK+DECKER dust buster Cordless Handheld Pet Vacuum. Portable for Stairs with Powerful Suction and Pet Brush.

BLACK+DECKER dust buster Cordless Handheld Pet Vacuum. Portable for Stairs with Powerful Suction and Pet Brush.

The BLACK+DECKER dust buster Cordless Handheld Pet Vacuum proves that you don’t need to break the bank for effective stair cleaning. This handheld model, a recognized leader in hand vacs, offers optimal performance with its 20V MAX* lithium-ion battery, delivering high suction power perfect for a vacuum for carpeted stairs. It even includes a POWERBOOST mode for extra oomph with just a touch of a button, making it an ideal choice for tackling stubborn pet hair and everyday debris.

Key Features That Stand Out

  • ✓ Powerful 20V MAX* lithium-ion battery provides high suction for effective cleaning.
  • ✓ POWERBOOST mode offers extra suction at the touch of a button for tougher messes.
  • ✓ Includes a specialized pet brush attachment, ideal for removing embedded pet hair.
  • ✓ Cordless and portable design ensures easy use on stairs, upholstery, and in vehicles.

Why We Recommend It

The BLACK+DECKER dust buster delivers surprising power and features for its price point, making it an excellent budget-friendly choice for tackling pet hair and general debris on carpeted stairs. The POWERBOOST mode is a real game-changer for stubborn spots, ensuring a thorough clean without a hefty investment.

Best For

Those on a budget seeking a reliable, cordless handheld vacuum with strong suction, especially for pet hair on stairs, who value convenience and powerful performance.

Pros and Cons

Pros:
  • Excellent suction power for a handheld, significantly boosted by POWERBOOST mode.
  • Cordless convenience provides freedom of movement for cleaning stairs and cars.
  • Specialized pet brush is highly effective for embedded pet hair removal.
  • Easy to clean and maintain with its washable filter system.
  • Offers great value for money, providing premium features at an accessible price.
Cons:
  • Battery life might be shorter when continuously using POWERBOOST mode.
  • Dustbin capacity is typical for a handheld, requiring frequent emptying for larger tasks.
  • Can be a bit noisy, especially when operating in POWERBOOST mode.

Customer Reviews

Customer Review: “This little vacuum is a beast. Hands down the best little hand held vacuum. I use this to vacuum my furniture and beds. It works so well I ordered another one for my vehicle. I have a SUV and this is perfect to keep it clean inside. The suction is very strong. Hold a great charge about 45mins. Has 2”

Customer Review: “Awesome! Nice power and SO easy to clean!Charging takes a bit, but this little thing has strong suction, perfect for vacuuming carpeted stairs. It is so simple to clean the filter: just pull it out and you can wash it in the sink. I love that the roller brush is made of rubber vs. fine synthetic bri”

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

4. Cordless Pet Hair Handheld Vacuum. High Power with Motorized Brush, LED Light, and Reusable Filter.

Cordless Pet Hair Handheld Vacuum. High Power with Motorized Brush, LED Light, and Reusable Filter.

Say goodbye to stubborn pet hair with the VC038S Cordless Pet Hair Handheld Vacuum, a powerful contender for the best vacuum for carpeted stairs. This ultimate cordless handheld vacuum for pet owners boasts an impressive 20,000 PA suction power, a significant upgrade from many other handheld models. It’s engineered for effortless cleaning with a built-in automatic motorized brush and an LED light, ensuring no speck of dust or hair is missed, even in the darkest corners of your stairs. The 10400mAh battery with Type-C fast charging also means it’s ready when you are.

Key Features That Stand Out

  • ✓ Boasts an impressive 20,000 PA suction power, 60% stronger than many competitors.
  • ✓ Built-in automatic motorized brush efficiently tackles embedded pet hair.
  • ✓ Integrated LED light illuminates dark spots, ensuring thorough cleaning on stairs.
  • ✓ High-capacity 10400mAh battery with Type-C fast charging for quick power-ups.
  • ✓ Features a reusable filter for eco-friendly and cost-effective maintenance.
See also  5 Best Orbit Sanders: Expert Tested for Superior Quality

Why We Recommend It

This cordless handheld vacuum stands out with its exceptional suction power and thoughtful features like a motorized brush and LED light. It’s a robust solution for thoroughly cleaning carpeted stairs, especially if you have pets, ensuring that even the most stubborn debris is picked up.

Best For

Individuals seeking a high-powered cordless handheld vacuum with extra features like an LED light and motorized brush for detailed and effective cleaning of carpeted stairs and tight spaces.

Pros and Cons

Pros:
  • Extremely strong 20,000 PA suction power for superior cleaning performance.
  • Motorized brush and LED light significantly enhance cleaning effectiveness and visibility.
  • Long-lasting battery with convenient Type-C fast charging capability.
  • Reusable filter design reduces ongoing costs and environmental waste.
  • Lightweight and ergonomic design makes it comfortable for extended cleaning sessions.
Cons:
  • Higher price point compared to more basic handheld vacuum models.
  • Charging time, even with fast charging, is still a factor to consider before use.
  • Dustbin capacity is primarily designed for spot cleaning, not large area tasks.

Customer Reviews

Customer Review: “I’m absolutely thrilled with this handheld vacuum — it’s been a total game-changer for keeping my home (and car) free of pet hair. The suction power is surprisingly strong — it picked up fur, dust, and debris in seconds from carpet, sofas, and even between car seats. The built-in motorized brush rea”

Customer Review: “Practical little vacuum cleaner for the RV. Picks up the dog hair with ease. Lite and easy to clean. It charges quickly. Weve used this on our last road trip and think it is better than our home vacuum.”

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

5. Shark UltraCyclone Pet Pro Plus Cordless Hand Vacuum. Powerful Suction for Stairs with Pet Power Brush.

Shark UltraCyclone Pet Pro Plus Cordless Hand Vacuum. Powerful Suction for Stairs with Pet Power Brush.

The Shark UltraCyclone Pet Pro Plus Cordless Hand Vacuum lives up to its powerful name, making it an excellent contender for the best vacuum for carpeted stairs. Designed for quick cleanups at home, in the car, and for unexpected pet hair, this compact yet mighty device offers ultra-powerful suction thanks to its two cyclonic air streams. Its 4-in-1 versatility and inclusion of three premium cleaning tools, including a dedicated Pet Power Brush, make it exceptionally adept at tackling embedded dirt and pet dander on carpets.

Key Features That Stand Out

  • ✓ Ultra-powerful suction generated by two distinct cyclonic air streams.
  • ✓ Includes a specialized Pet Power Brush, perfect for digging out embedded pet hair.
  • ✓ Offers 4-in-1 versatility with three premium cleaning tools for various tasks.
  • ✓ Compact, lightweight, and specifically built for quick cleanups around the house and in vehicles.
  • ✓ Engineered for long-lasting filter and motor life, ensuring durability.

Why We Recommend It

The Shark UltraCyclone Pet Pro Plus lives up to its name, offering powerful suction and excellent versatility in a compact form factor. Its specialized Pet Power Brush makes it an outstanding choice for keeping carpeted stairs free of pet hair and everyday dirt, ensuring a truly clean home.

Best For

Homeowners, especially those with pets, who need a powerful and versatile cordless handheld vacuum for quick cleanups on carpeted stairs, upholstery, and cars.

Pros and Cons

Pros:
  • Exceptional suction power for a handheld, capable of tackling tough messes effectively.
  • Comes with a dedicated Pet Power Brush that excels at pet hair removal from carpets.
  • Highly versatile with multiple attachments for various cleaning tasks and surfaces.
  • Compact and lightweight design makes it incredibly easy to carry and use on stairs.
  • Durable construction with long-lasting filter and motor promises extended use.
Cons:
  • Battery life, typical for handhelds, is best suited for spot cleaning rather than prolonged use.
  • The dustbin might require frequent emptying if you’re tackling significant amounts of debris.
  • Its premium features and brand name can lead to a slightly higher price point.

Customer Reviews

Customer Review: “I did a lot of research before I purchased this vacuum and repeatedly the reviews and recommendations about this vacuum were good. It does not disappoint; this a great vacuum. The attachments are easy to use. It is small enough to be used on small messes but strong enough to handle larger messes.”

Customer Review: “The Shark UltraCyclone Pet Pro Plus Cordless Hand Vacuum does a fantastic job picking up cat hair from both the floor and the bed. It’s lightweight, easy to handle, and cleans thoroughly. My only minor gripe is that the battery could last a bit longer, but it’s not a dealbreaker.”

Complete Buying Guide for Best Vacuum For Carpeted Stairs

Choosing the best vacuum for carpeted stairs can significantly impact how clean your home feels and how much effort you put into maintaining it. It’s not just about picking any vacuum; it’s about finding the right tool that makes this specific, often challenging, cleaning task a breeze. Let’s walk through the essential factors to consider to ensure you make the perfect choice for your home.

Essential Factors We Consider

When you’re looking for a vacuum specifically designed for carpeted stairs, certain features become paramount. First and foremost is portability and weight. Hauling a heavy, traditional upright vacuum up and down stairs is not only cumbersome but also potentially unsafe. Look for lightweight handheld models, compact canister vacuums, or stick vacuums with detachable handheld components. These designs make it easy to maneuver and reach every step without straining yourself.

Next, consider suction power and brush type. Carpeted stairs often trap dirt, dust, and pet hair deep within the fibers. A vacuum with strong suction is crucial for lifting this embedded debris. For carpets, a motorized brush or a brush roll designed to agitate carpet fibers is highly effective at dislodging stubborn dirt and pet hair. Static brushes or suction-only tools might struggle to provide a deep clean on plush or high-pile carpets.

The choice between cordless vs. corded is also a big one. Cordless vacuums offer unmatched freedom of movement, allowing you to clean without constantly searching for outlets or wrestling with tangled cords. This is a huge advantage for stairs. However, corded models typically offer consistent, stronger suction for longer periods. If you have many stairs or prefer uninterrupted power, a corded option might be better, provided it’s lightweight enough to carry. Battery life is a critical factor for any cordless model – ensure it’s sufficient for your entire staircase.

See also  5 Best Upright Vacuum Sweepers: Expert-Vetted for Quality Performance

Finally, don’t overlook the importance of attachments and accessories. A crevice tool is indispensable for tight corners, while an upholstery tool can refresh stair runners or furniture. For pet owners, a specialized pet hair tool or a mini motorized brush attachment is a must-have for effective pet hair removal. A vacuum with a decent dustbin capacity and easy-to-clean filters will also make maintenance simpler.

Budget Planning

Your budget will naturally influence your options for the best vacuum for carpeted stairs. Handheld vacuums tend to be the most affordable entry point, offering basic functionality for quick cleanups. Mid-range options often include more powerful handhelds with specialized pet tools or compact canister vacuums that offer a good balance of power and portability. At the higher end, you’ll find premium cordless handhelds with advanced features, longer battery life, and superior suction. While it might be tempting to go for the cheapest option, remember that investing a little more can often get you better suction, more durable construction, and a more enjoyable cleaning experience. Consider how often you’ll use the vacuum and how critical stair cleaning is to your routine. Sometimes, paying a bit more upfront saves you frustration and potential replacement costs down the line.

Final Thoughts

Ultimately, the “best” vacuum for carpeted stairs is one that perfectly aligns with your specific cleaning needs and lifestyle. Whether you prioritize lightweight portability, powerful pet hair removal, or budget-friendly convenience, there’s a vacuum out there for you. By carefully considering factors like weight, suction power, brush types, and cordless freedom, you can find a vacuum that transforms stair cleaning from a dreaded chore into a manageable task. Don’t settle for less when it comes to keeping every corner of your home, including your stairs, sparkling clean!

Frequently Asked Questions

Q: Why is a specialized vacuum needed for carpeted stairs?

A: Traditional upright vacuums are often too bulky and heavy to safely or effectively maneuver on narrow stair treads. Specialized vacuums, like handhelds or lightweight canister models, offer the portability, compact size, and appropriate attachments needed to reach all areas of carpeted stairs for a thorough clean.

Q: What features are most important for cleaning pet hair on stairs?

A: For pet hair on carpeted stairs, look for a vacuum with a strong suction, and critically, a motorized brush tool or a pet power brush. These attachments are designed to agitate carpet fibers and lift embedded pet hair that suction alone might miss. Cordless convenience also makes the task much easier.

Q: Are cordless vacuums powerful enough for deep cleaning carpeted stairs?

A: Absolutely! Many modern cordless handheld vacuums and stick vacuums (with detachable handheld units) now offer impressive suction power, especially when combined with specialized motorized brush tools. While their battery life might not last for a whole-house deep clean, they are more than sufficient for thoroughly cleaning typical staircases.

Q: How often should I vacuum my carpeted stairs?

A: The frequency depends on factors like foot traffic, presence of pets, and allergies. Generally, it’s recommended to vacuum carpeted stairs at least once or twice a week to prevent the buildup of dirt, dust, and allergens. Homes with pets or high traffic may benefit from more frequent cleaning.

Q: What’s the main difference between a handheld and a canister vacuum for stairs?

A: Handheld vacuums are typically smaller, lighter, and always cordless, offering maximum portability and ease of use for quick spot cleaning on stairs. Canister vacuums are generally more powerful, often corded, and have larger dust capacities. While you still carry the main unit, the wand and hose offer flexibility. Handhelds are great for speed, while canisters might offer more sustained power and capacity for larger staircases.

There you have it! Finding the best vacuum for carpeted stairs doesn’t have to be a daunting task. We’ve explored some fantastic options, from powerful cordless handhelds perfect for pet hair to lightweight canister vacuums that tackle multi-surface cleaning with ease. Each of these vacuums offers unique benefits that can significantly lighten your cleaning load and ensure your stairs remain spotless. We hope this guide helps you make an informed decision and find the perfect vacuum that fits your needs and makes stair cleaning genuinely hassle-free. Happy cleaning!

// Fetch real-time product data for all products when page loads
(function() {
const products = [‘B07GB4S9H5’, ‘B07CB6RBSP’, ‘B07R89PJY6’, ‘B0FB3D4YW3’, ‘B08559H8W2’];
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