Top 6 Best Keyboards For Learning Piano for 2026 – Expert Picks

Learning to play the piano is a wonderfully rewarding journey, and having the right keyboard for beginners can make all the difference. Whether you’re a complete novice, returning to music, or looking for the perfect instrument for a child, finding the best keyboard for learning piano means balancing features like key count, touch sensitivity, and built-in learning tools. We understand that starting can feel overwhelming with so many options, which is why we’ve put together this expert-tested guide. We’ve explored various models to bring you the top picks that offer a great blend of functionality, affordability, and user-friendliness, ensuring your first steps into piano playing are as smooth and enjoyable as possible.

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. Alesis Melody 61-Key Keyboard Piano with Speakers, Music Stand, 300 Sounds, and Lessons…. Alesis Melody 61-Key Keyboard Piano with Speakers, Music Stand, 300 So ⭐ N/A Check Price
2. 61-Key Electric Piano Keyboard for Beginners, with Light-Up Keys and Learning System…. 61-Key Electric Piano Keyboard for Beginners, with Light-Up Keys and L ⭐ 4.5/5 Check Price
3. RockJam RJ761 61 Key Keyboard Piano with Keyboard Bench, Digital Piano Stool, Sustain Pedal, Head…… RockJam RJ761 61 Key Keyboard Piano with Keyboard Bench, Digital Piano ⭐ 4.4/5 Check Price
4. MUSTAR 61-Key Electric Piano Keyboard for Beginners, with Lighted Keys, Headphones, and Stool…. MUSTAR 61-Key Electric Piano Keyboard for Beginners, with Lighted Keys ⭐ 4.5/5 Check Price
5. RockJam 61-Key Compact Keyboard Piano with LED Display, Keynote Stickers & Lessons… RockJam 61-Key Compact Keyboard Piano with LED Display, Keynote Sticke ⭐ 4.4/5 Check Price
6. Removable Piano Keyboard Stickers with Large Letters for Beginners and Kids Learning, Fits All Keybo… Removable Piano Keyboard Stickers with Large Letters for Beginners and ⭐ 4.6/5 Check Price

Our Top 6 Best Keyboards For Learning Piano Reviews – Expert Tested & Recommended

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

🏆 Best Choice

1. Alesis Melody 61-Key Keyboard Piano with Speakers, Music Stand, 300 Sounds, and Lessons.

Alesis Melody 61-Key Keyboard Piano with Speakers, Music Stand, 300 Sounds, and Lessons.

The Alesis Melody 61-Key Keyboard Piano is a fantastic starting point for aspiring pianists of all ages. This compact electric keyboard provides a great blend of features for learning and exploration, making it one of the best keyboards for learning piano. With its comprehensive sound library and included accessories, it sets you up for success right out of the box.

Key Features That Stand Out

  • ✓ 61 full-size keys for developing finger strength and dexterity, crucial for any beginner piano student.
  • ✓ A massive sound library of 300 inspiring built-in sounds, allowing for creative exploration and various musical styles.
  • ✓ Comes with essential accessories including a music stand, power adapter, and access to online piano lessons.
  • ✓ Features 300 accompaniment rhythms, plus the ability to layer or split two sounds for advanced playing.
  • ✓ Integrated speakers ensure you can play and practice without needing external equipment.

Why We Recommend It

We recommend the Alesis Melody because it truly offers an “everything you need to start” package. The inclusion of online lessons and a music stand means less hassle for new learners. The variety of sounds and rhythms will keep practice engaging and inspire creativity, making it a versatile digital piano for beginners.

Best For

This keyboard is ideal for both children and adults who are absolute beginners and want a comprehensive package to kickstart their piano learning journey. It’s also great for those looking for a portable yet feature-rich 61-key keyboard.

Pros and Cons

Pros:
  • Comes with everything needed to start, including online lessons.
  • Wide range of sounds and rhythms for diverse musical exploration.
  • Compact and portable design, easy to move and set up.
  • Good value for money given the features and accessories.
Cons:
  • Keys are not weighted, which might be a concern for advanced classical training later.
  • Some users report a preference for older versions regarding build quality.

Customer Reviews

Customer Review: “I ordered this 61-key piano for my son who turned 5, and it arrived in perfect condition. It works exactly as described and was easy to set up. I specifically chose the older version after reading that many customers had issues with the newer one—and I’m glad I did. The sound quality is great for a beginner.”

Customer Review: “Bought it for my granddaughters. They love it. It sounds great. Can run on batteries or plug in. Love that it’s portable. They bring back and forth a lot. Great buy.”

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

⭐ Editor’s Choice

2. 61-Key Electric Piano Keyboard for Beginners, with Light-Up Keys and Learning System.

61-Key Electric Piano Keyboard for Beginners, with Light-Up Keys and Learning System.

This 61-Key Electric Piano Keyboard for Beginners stands out with its innovative light-up keys and smart learning system, making the initial sshoukhintech01-20es of learning piano incredibly intuitive and fun. It’s designed to act like a personal teacher, guiding you every step of the way, making it an excellent choice among keyboards for learning piano.

Key Features That Stand Out

  • ✓ Light-up keys visually guide your fingers, significantly simplifying the process of finding the right notes.
  • ✓ Powered by a next-generation sound chip and 2 built-in stereo speakers for crystal-clear, rich sound quality.
  • ✓ Features a Smart 3-Step Learning System: Single Key, Follow, and Ensemble modes to progress at your own pace.
  • ✓ Offers a substantial library of 60 demo songs, 200 rhythms, and 200 tones to keep practice varied and exciting.
  • ✓ Ability to record and playback, allowing learners to review their progress and technique.

Why We Recommend It

The light-up keys are a game-changer for absolute beginners, especially kids, providing immediate visual feedback. The structured learning system helps build foundational skills step-by-step, transforming what can be a daunting task into an enjoyable experience. It’s truly a great electric piano keyboard for beginners.

Best For

This keyboard is perfect for children and young beginners who benefit greatly from visual cues and structured learning paths. It’s also suitable for adults who want an easy, engaging way to learn the basics of piano without a formal instructor.

Pros and Cons

Pros:
  • Light-up keys provide excellent visual guidance for new learners.
  • Structured 3-step learning system makes progression easy and clear.
  • Good sound quality from built-in speakers.
  • Numerous demo songs, rhythms, and tones for variety.
Cons:
  • 61 keys might feel limiting for very advanced pieces later on.
  • Keys are not weighted, which affects the feel compared to an acoustic piano.

Customer Reviews

Customer Review: “This is great for kids who are just learning, it helps to learn notes well. As well as has many different songs to learn on it.”

Customer Review: “My 5-year-old grandson has autism. So far, he is non-verbal. On top of that, neither one of his parents could carry a tune in a bucket. It is hard to keep him occupied in a positive way, especially when the weather is harsh. When his teacher started to play piano and tried to get the kids to sing, my grandson was intrigued. I bought this light-up keyboard to introduce him to it in hopes of him picking up on the music. He loves it! He started pressing keys, mimicking the tunes on the keys, and loves the light-up feature. Best money spent.”

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

💰 Best Budget

3. RockJam RJ761 61 Key Keyboard Piano with Keyboard Bench, Digital Piano Stool, Sustain Pedal, Head…

RockJam RJ761 61 Key Keyboard Piano with Keyboard Bench, Digital Piano Stool, Sustain Pedal, Head...

For those seeking a comprehensive package without breaking the bank, the RockJam RJ761 61 Key Keyboard Piano is an unbeatable option. It’s not just a keyboard; it’s a complete starter kit designed to get you playing immediately. This makes it a fantastic and accessible choice for anyone looking for the best budget keyboard for learning piano.

Key Features That Stand Out

  • ✓ A full-sized 61-key electronic keyboard, providing a traditional piano feel that’s essential for beginner piano practice.
  • ✓ Includes a keyboard bench, digital piano stool, sustain pedal, and headphones, offering an all-in-one setup.
  • ✓ Features a touch screen interface for easy access to 200 rhythms and 200 sounds, enhancing user experience.
  • ✓ Built-in recording and playback functions allow for effortless sound layering and progress tracking.
  • ✓ MIDI output for seamless integration with other music software and devices, expanding its utility.

Why We Recommend It

This RockJam package is exceptional value. Getting a keyboard, bench, sustain pedal, and headphones together means you’re fully equipped to learn and practice in any environment. The touch screen and MIDI capabilities offer surprising depth for its price point, solidifying its spot as a top beginner digital piano.

Best For

This kit is ideal for budget-conscious beginners who want a complete, ready-to-play setup without additional purchases. It’s also great for families with young learners, as the included accessories make it very convenient.

Pros and Cons

Pros:
  • Comes as a complete package with essential accessories (bench, pedal, headphones).
  • Touch screen interface provides easy navigation and feedback.
  • Good range of rhythms and sounds for creative learning.
  • MIDI output offers expandability for more advanced users.
Cons:
  • Keys are not weighted, which might not mimic an acoustic piano’s feel.
  • The included headphones might not be studio-quality.

Customer Reviews

Customer Review: “First off, to anyone hesitant about buying an Amazon “Used – Like New” product — don’t be! I’ve purchased several items this way, and every single one, including this RockJam keyboard, arrived in mint, untouched condition, sealed in the original packaging. You’re basically getting a brand-new product for a discounted price! This is such a great keyboard. I am putting it together for my son to have on Christmas and I know he’s going to be sooooo happy. The keyboard has so many beautiful sounding speakers and comes with headphones for him to quietly play lol. The quality of the keyboard&sheet music stand is so much more than I expected for the price. Such a great buy!”

Customer Review: “This is such a great keyboard. I am putting it together for my son to have on Christmas and I know he’s going to be sooooo happy. The keyboard has so many beautiful sounding speakers and comes with headphones for him to quietly play lol. The quality of the keyboard&sheet music stand is so much more than I expected for the price. Such a great buy!”

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

4. MUSTAR 61-Key Electric Piano Keyboard for Beginners, with Lighted Keys, Headphones, and Stool.

MUSTAR 61-Key Electric Piano Keyboard for Beginners, with Lighted Keys, Headphones, and Stool.

The MUSTAR 61-Key Electric Piano Keyboard is designed with the beginner in mind, offering a friendly and engaging way to start playing. Its standout feature of lighted keys, combined with included accessories, makes it a highly appealing option for new learners and positions it well among the best keyboards for learning piano, especially for younger students.

Key Features That Stand Out

  • ✓ Lighted-up keys provide visual cues, guiding beginners to the correct notes and simplifying learning.
  • ✓ Comes as a complete kit, including headphones and a stool, ensuring a comfortable and quiet practice environment.
  • ✓ Features 3 intelligent Teaching Modes: One Key, Follow, and Ensemble mode, catering to different learning styles.
  • ✓ Offers rich music selections with an audio input function to play along with favorite songs.
  • ✓ Portable size (36.6*12*30 inches) makes it easy to move around and set up in various spaces.

Why We Recommend It

The MUSTAR keyboard excels in making piano learning accessible and enjoyable. The lighted keys remove much of the initial intimidation, and the integrated teaching modes are excellent for self-paced progress. The bundled headphones and stool add immense value, making it a ready-to-use beginner digital piano.

Best For

This keyboard is perfectly suited for children and young adults taking their first steps in piano. Its guided learning features and comprehensive accessories make it a stress-free choice for parents and beginners alike.

Pros and Cons

Pros:
  • Lighted keys provide direct visual feedback for learning.
  • Includes essential accessories: headphones for quiet practice and a stool for proper posture.
  • Multiple intelligent teaching modes cater to various learning paces.
  • Audio input allows for playing along with external music.
Cons:
  • 61 keys might limit repertoire for advanced pieces.
  • Keys are not weighted, which can differ from acoustic piano feel.

Customer Reviews

Customer Review: “Works well and the description is accurate. Lots of different functions. Happy with how loud the volume goes as well. Surprisingly low price for how good the quality is. Definitely recommend.”

Customer Review: “My 5 year old got this for Christmas and loves it! The headphones are perfect for keeping noise level down. Very sturdy and good for beginners!”

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

5. RockJam 61-Key Compact Keyboard Piano with LED Display, Keynote Stickers & Lessons

RockJam 61-Key Compact Keyboard Piano with LED Display, Keynote Stickers & Lessons

The RockJam 61-Key Compact Keyboard Piano offers a fantastic blend of features tailored for the aspiring musician. With its intuitive LED display, included keynote stickers, and access to lessons, it provides a solid foundation for anyone starting their musical journey. This model is a strong contender when considering the best keyboards for learning piano due to its thoughtful design for beginners.

Key Features That Stand Out

  • ✓ Features 61 keys, along with 200 sounds, 200 rhythms, and 10 demo songs for diverse musical exploration.
  • ✓ An integrated LED display provides immediate visual feedback, assisting with note recognition and learning.
  • ✓ Comes with piano keynote stickers to help visualize notes and improve muscle memory, a huge plus for new learners.
  • ✓ Includes sustain and vibrato functions, alongside record and playback capabilities, to enhance creativity and practice.
  • ✓ Access to online piano lessons helps guide beginners through fundamental techniques and theory.

Why We Recommend It

The RockJam RJ361 is excellent for new learners, particularly kids, because the keynote stickers and LED display offer tangible aids for understanding the keyboard layout. The inclusion of various sounds and rhythms keeps practice engaging, preventing boredom. It’s a highly portable and effective beginner piano.

Best For

This keyboard is ideal for young musicians and absolute beginners who benefit from visual learning aids and a structured approach to understanding notes and scales. Its compact size also makes it great for smaller living spaces.

Pros and Cons

Pros:
  • Keynote stickers and LED display are great visual learning tools.
  • Compact and lightweight, making it easily portable.
  • Wide variety of sounds and rhythms to keep learning interesting.
  • Recording and playback features aid in practice and composition.
Cons:
  • Keys are not weighted, which might not be ideal for advanced technique development.
  • 61 keys can be limiting for more complex classical pieces.

Customer Reviews

Customer Review: “Very adequate for learning basic piano skills and music the ranges close to middle range. Durable, light weight and good key quality.”

Customer Review: “I see a lot of reviews for using this device for kids as a beginner piano. This is a great product, but you have to understand what it is before buying it. If you want to buy a device for you or your kid to learn how to play piano, this isn’t what you want. You’ll probably want a full size keyboard with weighted keys for a serious learner. This is a fantastic ‘toy’ for kids to learn and have fun on, and probably good for a very casual adult learner.”

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

6. Removable Piano Keyboard Stickers with Large Letters for Beginners and Kids Learning, Fits All Keyboards.

Removable Piano Keyboard Stickers with Large Letters for Beginners and Kids Learning, Fits All Keyboards.

While not a keyboard itself, these Removable Piano Keyboard Stickers are an invaluable accessory for anyone learning piano, especially absolute beginners and children. They serve as a visual aid to quickly identify notes, making the learning process much faster and more intuitive. For those seeking comprehensive help with finding the best keyboards for learning piano, these stickers can significantly enhance the experience of any entry-level instrument.

Key Features That Stand Out

  • ✓ Universally compatible, designed to fit all 88, 61, 54, 49, and 37 key pianos and keyboards.
  • ✓ Features large, clear letters printed on the backside of transparent stickers, ensuring durability against constant finger contact.
  • ✓ The adhesive is clean and strong, allowing for multiple applications and removals without leaving residue on keys.
  • ✓ White key stickers measure 4.0cmX1.55cm and black key stickers 3.9cmX0.85cm, perfectly sized for visibility.
  • ✓ Simplifies note recognition and speeds up the learning curve for sight-reading and chord formation.

Why We Recommend It

These stickers are a game-changer for speeding up the initial learning phase. They bridge the gap between recognizing notes on sheet music and finding them on the keyboard, significantly reducing frustration for beginners. They’re a simple, affordable tool that complements any beginner piano or digital piano.

Best For

These stickers are essential for absolute beginners, young children, and anyone struggling with note recognition on the piano. They’re also great for self-learners who don’t have an instructor to guide them on key locations.

Pros and Cons

Pros:
  • Dramatically speeds up note recognition for beginners.
  • Easy to apply and remove without damaging keys or leaving residue.
  • Highly durable with letters printed on the underside.
  • Compatible with a wide range of keyboard sizes.
Cons:
  • Can become a crutch if not eventually removed, hindering true note memorization.
  • Some users might prefer light-up keys over physical stickers.

Customer Reviews

Customer Review: “Very easy to stick on the piano keys and it comes with clear instructions. Makes learning much easier and helps a lot with note recognition. Great product!”

Customer Review: “I’m glad I got these to help me learn the keys on the piano. They stick well, fit well on the keys, I like the colors, and easy instructions for placing them. I would recommend!”

Complete Buying Guide for Best Keyboards For Learning Piano

Essential Factors We Consider

When searching for the best keyboard for learning piano, there are a few key elements that can truly make or break your experience. First, consider the number of keys. While a full 88-key keyboard mimics an acoustic piano, a 61-key keyboard is often sufficient and more portable for beginners. Next, key action is crucial; look for keys that offer some resistance, mimicking the feel of a real piano. While fully weighted keys are ideal, semi-weighted or touch-sensitive keys are a good compromise for a beginner piano. Sound quality is also vital; a good digital piano should offer realistic piano tones and preferably built-in speakers. Finally, look for helpful learning features like metronomes, recording functions, and built-in lessons or light-up keys, which can significantly accelerate your progress.

Budget Planning

Budget plays a significant role in choosing your first electric piano keyboard. Entry-level models typically range from $100-$300, offering basic features and 61 keys—perfect for testing the waters without a huge investment. Mid-range options ($300-$700) might introduce more realistic key action (like semi-weighted keys), a larger sound library, and better build quality, often with 88 keys. High-end beginner digital pianos ($700+) typically feature fully weighted, hammer-action keys that closely replicate an acoustic piano, along with advanced connectivity and superior sound engines. Remember to factor in accessories like a stand, bench, sustain pedal, and headphones, which can add to the total cost. Sometimes, bundled packages, like some of our recommendations, offer the best value.

Final Thoughts

Choosing your first keyboard for learning piano is exciting! It’s about finding a balance between features that support your learning, your budget, and the space you have available. Don’t feel pressured to buy the most expensive model right away. A good beginner piano should inspire you to practice and explore music. Focus on getting a keyboard with good sound, comfortable keys, and useful learning tools. As you progress, you’ll naturally discover what specific features become most important to you, guiding your next upgrade.

Frequently Asked Questions

Q: Do I need 88 keys to learn piano?

A: While an acoustic piano has 88 keys, a 61-key keyboard is perfectly adequate for most beginners, especially for learning foundational skills, chords, and many popular songs. As you advance, especially into classical repertoire, you might eventually want an 88-key instrument, but it’s not a strict requirement to start.

Q: What are light-up keys and are they helpful for beginners?

A: Light-up keys are a fantastic feature for beginners, especially children. They illuminate to show you which notes to play, acting like a visual guide. This can make learning new songs much easier and more engaging, helping new students quickly grasp finger placement and note recognition without needing to constantly look at sheet music.

Q: Should I get a keyboard with weighted keys?

A: For serious piano students, weighted keys (or semi-weighted for a lighter touch) are highly recommended. They mimic the resistance and feel of an acoustic piano, helping to develop proper finger strength and technique. If your budget allows, opting for a keyboard with at least semi-weighted keys will provide a more authentic playing experience from the start.

Q: Can I connect these keyboards to a computer for lessons or recording?

A: Many modern digital pianos and keyboards, even beginner models, come with USB or MIDI connectivity. This allows you to connect them to a computer or tablet for online lessons, music production software, or recording your performances. Always check the product specifications if this is a feature you need.

Q: How important is sound quality for a beginner keyboard?

A: Good sound quality is quite important, even for beginners. A pleasing and realistic piano sound will keep you motivated and engaged in practice. While budget keyboards might not have the richness of high-end models, they should still offer clear and accurate tones. Built-in stereo speakers are a definite plus for a fulfilling practice experience.

Embarking on your piano journey is a fantastic decision, and choosing the best keyboard for learning piano is your first step towards musical enjoyment. Each of the keyboards and accessories we’ve reviewed offers unique benefits tailored for beginners, whether you prioritize guided learning, a complete bundled package, or simply the most budget-friendly entry point. Remember, the best instrument is the one that inspires you to sit down and play. Don’t hesitate to pick the one that feels right for you and start creating beautiful music today!

// Fetch real-time product data for all products when page loads
(function() {
const products = [‘B0D2CYH6Q7’, ‘B0DWDX495K’, ‘B06XBZH1DZ’, ‘B0C5DH472P’, ‘B07FDL3NGT’, ‘B08337LTJ7’];
const affiliateTag = ‘shoukhintech01-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