0

I have a list of YouTube URLs in a Google Sheet, and I'm trying to figure out a way to extract their viewcount information so I can total them up.

In the past, I've done this by creating a playlist of the videos in question and using this workaround solution but unfortunately that YouTube Playlist Analyzer tool no longer exists.

I found a potential solution using ScreamingFrog's Custom Extraction tool, but unfortunately that requires purchasing a full license, which if possible I'd like to avoid since this is a one-and-done kind of task.

So if anyone knows of a way to extract number of views from YouTube URLs (as a batch or one at a time) that would be super helpful!

Thank you!

1 Answers1

1

In former projects I've found the following approach of web scraping very simple and useful.

Loop over a list of URLs, or get the video IDs and put them into a variable.

VIDEOID="<videoid>"

Gather the content behind the URL.

CONTENT=$(curl --silent "https://www.youtube.com/watch?v=${VIDEOID}" -w "\n\n%{http_code}\n")

Analyze the output, find where the information is stored and just grep out the information.

COUNT=$(echo "${CONTENT}" | grep -o -P "(?<=videoViewCountRenderer).*?(?=Aufrufe)" | rev | cut -d '"' -f 1 | rev)
echo "${COUNT}"

You may also have a look into Shell Script to download youtube files from playlist as well into YouTube Data API and

Resource representation - statistics.viewCount

Thanks to

U880D
  • 8,601
  • 6
  • 24
  • 40