Yo, FunWithAI crew! Ever stared at a YouTube Shorts page, thinking, “I need all these titles, views, and thumbnails in a spreadsheet, but I’m not about to copy-paste like it’s 1999”? Whether you’re a data nerd, a content creator, or just procrastinating on your actual work (no judgment), I’ve got a JavaScript trick that’ll make you feel like a web-scraping superhero.
Today, we’re grabbing all the juicy details from YouTube Shorts – like titles, view counts, URLs, and thumbnails – straight from your browser’s console. No PhD in Rocket Science required!
In this post, I’ll share the code, walk you through running it, and show you how to turn the data into a spreadsheet-ready format. Ready to copy your Shorts data like a pro? Let’s dive in!
To make this extra tasty, I’m using my wife’s amazing Shorts channel, @cook-with-priti, as our example. She’s whipping up drool-worthy recipes in 60 seconds or less, and trust me, you’ll want to scrape her Shorts just to keep track of all the deliciousness. Let’s dive in, have a laugh, and get that data into a spreadsheet faster than you can say “algorithm”!
Why Bother Scraping YouTube Shorts?
Shorts are the internet’s current obsession—think Instagram, but with YouTube’s vibe. If you’re running a channel like @cook-with-priti (go subscribe, her recipes are chef’s kiss), you might want to:
- Spot your viral hits (like that one Short with 194K views—yowza! ).
- Organize your content for your next big pitch to a food brand.
- Build a fancy thumbnail gallery to flex your editing skills.
- Or just geek out because data is your love language.
Manually copying this stuff? Nope, that’s a one-way ticket to Carpal Tunnel City. Instead, we’ll use a quick JavaScript script to scrape everything from @cook-with-priti’s Shorts page (or yours) and make it spreadsheet-ready. Let’s do this!
Who Can Use This and How It Boosts Your Shorts Game
This scraping trick is a game-changer for content creators, social media managers, marketers, and data enthusiasts. If you’re a YouTuber like @cook-with-priti, you can analyze which Shorts are popping (e.g., that paneer tikka recipe with 12K views) to double down on what works – maybe more spicy recipes or quick desserts. Social media pros can track client channels, spotting trends to pitch better content strategies.
Marketers can use view counts and titles to craft targeted campaigns, while data nerds can feed this into analytics tools for next-level insights. With the scraped data, you can sort by views to find your top performers, study thumbnail styles that grab attention, or plan a content calendar based on what’s hot. It’s like having a cheat code to make your Shorts slay the algorithm!
The Master Plan (No Evil Laugh Required)
Here’s what our script will do:
- Hit the Shorts page: We’ll scrape from a channel’s Shorts tab, like https://www.youtube.com/@cook-with-priti/shorts.
- Snag the goodies: Grab each Short’s title, view count (e.g., “2.5K views”), URL, and thumbnail.
- Polish it up: Strip view counts from titles and standardize thumbnails to hqdefault.jpg
- Spit out a spreadsheet-friendly list: One big, tab-separated block you can copy-paste into Excel or Google Sheets.
No servers, no libraries – just you, Chrome’s console, and a coffee to keep the vibes high.
The Code (a.k.a. Your New Best Friend)
Here’s the JavaScript magic to run in Chrome’s console. It’s simpler than assembling IKEA furniture and way more fun.
// Clear any existing scroll interval and console (because we’re tidy like that)
window.clearInterval(scroll);
console.clear();
// Select all video elements on the Shorts page
const shortElements = document.querySelectorAll('a[href*="/shorts/"]');
// Collect data in an array (like collecting Pokémon cards, but nerdier)
const data = [['Title', 'View Count', 'URL', 'Thumbnail']]; // Header row
shortElements.forEach((element) => {
// Get the video URL
const url = element.href;
// Get the title (from aria-label or text content, because YouTube’s DOM is a maze)
const titleElement = element.querySelector('h4') || element.querySelector('[id="video-title"]') || element;
let title = titleElement.getAttribute('aria-label') || titleElement.textContent.trim() || 'No title found';
// Clean title and yoink the view count
let viewCount = title.match(/\d+(\.\d+)?[KM]? views/i)?.[0] || 'No views found';
title = title.replace(/\d+(\.\d+)?[KM]? views/i, '').replace(/\s+/g, ' ').trim();
// Standardize thumbnail URL (because we’re fancy like that)
let thumbnail = 'No thumbnail found';
const videoId = url.match(/\/shorts\/([^\?]+)/)?.[1];
if (videoId) {
thumbnail = `https://i.ytimg.com/vi/${videoId}/hqdefault.jpg`;
}
// Add row to our data treasure chest
data.push([title, viewCount, url, thumbnail]);
});
// Convert data to tab-separated string (spreadsheet, here we come!)
const output = data.map(row => row.join('\t')).join('\n');
// Output the result like a boss
console.log(output);
What’s Happening Here?
- Hunting Shorts: We use querySelectorAll(‘a[href*=”/shorts/”]’) to find all Shorts links, like a digital treasure hunt.
- Stealing Titles: We grab titles from aria-label or text content, then kick out view counts and extra spaces.
- Counting Views: A sneaky regex snags “2.5K views” or “194K views” for a separate column.
- Tidying Thumbnails: We build clean hqdefault.jpg URLs from each Short’s video ID, because who needs chaos?
- Output Magic: Everything’s packed into one tab-separated block, so you don’t have to wrestle with console junk like VM prefixes.
How to Pull This Off (Without Breaking a Sweat)
Ready to scrap @cook-with-priti’s Shorts (or your own channel)? Follow these steps, and you’ll be swimming in data faster than you can burn toast.
1. Head to the Shorts Page
- Open Chrome and visit your channel’s Shorts page, like https://m.youtube.com/@cook-with-priti/shorts. (Pro tip: Check out Priti’s recipes while you’re there – your stomach will thank you!)
2. Load All the Shorts
- YouTube’s lazy—Shorts only load as you scroll. Let’s auto-scroll to grab ‘em all:
let scroll = setInterval(() => {
window.scrollBy(0, 1000);
if (window.innerHeight + window.scrollY >= document.body.scrollHeight) {
clearInterval(scroll);
}
}, 1000);
- Pop this into the Chrome console (Ctrl + Shift + J or Cmd + Opt + J on Mac), hit Enter, and wait a few seconds until no new Shorts load. Patience, grasshopper!
3. Unleash the Scraping Code
- Copy the main code above, paste it into the console, and smash Enter.
- Boom! You’ll get a glorious block of output like

4. Get It into a Spreadsheet
- Click and drag to select the output (skip any VM prefix if it sneaks in), then copy it (Ctrl + C or Cmd + C).
- Fire up Excel or Google Sheets, paste the data (Ctrl + V or Cmd + V), and watch it split into four neat columns: Title, View Count, URL, and Thumbnail.
- Your spreadsheet will look like a data chef’s masterpiece:

5. Play with Your Data (and Eat Some Snacks)
- Sort by view count to find your viral Shorts (Priti’s paneer tikka is probably killing it).
- Use thumbnail URLs to make a drool-worthy gallery for your next pitch.
- Whip up charts to show off your channel’s growth – because nothing says “I’m awesome” like a good bar graph.
Pro Tips (Because You’re Basically a Hacker Now)
- Don’t Overdo It: Scraping like you’re mining Bitcoin might make YouTube raise an eyebrow (hello, CAPTCHAs). Keep it chill.
- YouTube’s Sneaky Updates: The Youtube (m.youtube.com) loves changing its layout. If the code breaks, right-click > Inspect to snoop on new selectors for titles or thumbnails.
- Craving More? Want upload dates or likes? The YouTube Data API is your next adventure, but it needs an API key. Holler if you want a guide!
- Python Vibes: If JavaScript isn’t your jam, you can do this with Python’s BeautifulSoup or Selenium. Drop a comment for a Python remake!
Why This Is Cooler Than a Cucumber (and a Bit AI-ish)
Scraping Shorts is like giving your channel X-ray vision – you see what’s popping and what’s not in seconds. It’s also a gateway to web scraping, which is basically AI’s nerdy cousin. Imagine feeding this data to an AI to predict your next viral Short or summarize Priti’s recipes for a chatbot. (Siri, make me paneer tikka!) The future’s calling, and it’s got data.
Oh, and speaking of awesome Shorts, go check out @cook-with-priti! Her quick recipes are perfect for when you’re hungry but too lazy to spend hours in the kitchen. Subscribe, try her hacks, and maybe scrape her Shorts to see which dish is stealing the show.
Let’s Keep the Party Going
You’re now a Shorts-scraping legend! Run the code, play with your data, and tell me in the comments how it went. Did Priti’s chocolate mug cake Short blow up your spreadsheet? Got ideas for the next coding adventure – maybe a Python scraper or an AI recipe generator?
If you need the code for scraping regular YouTube videos too, drop a comment below, and I’ll hook you up! Hit me up, and let’s make more tech magic. Until then, keep coding, keep eating, and stay epic!
1 thought on “How to Copy YouTube Shorts Titles, View Counts, URLs, and Thumbnails”