YouTube content creation is complex and rarely ends with filming and editing the video. After uploading, you’re typically encouraged to upload timestamp markers for essential parts of your video. In this post, I’ll show you a quick C# script that can help you generate links to specific sections of your videos so you can use them in promotional blog posts and social media posts.
YouTube Videos and Timestamps
You typically get a video identifier in alphanumeric characters when you upload a video. For example, my latest YouTube video has the identifier u5y_aUP5Td0
. Additionally, as the webinar progresses, there are moments you’d like to highlight. YouTube will automatically link these timestamps when placed in the video’s description. Here’s an example.
When viewed on YouTube, the timestamp values will hyperlink to specific video portions. That’s great, but this format is limited to YouTube and can be difficult to share on your blog or other mediums.
Wouldn’t it be cool to use C# 11 features to generate these links quickly? With the flexibility of my script, I can produce any output that works for me: HTML, markdown, CSV, etc.
Using C# 11 To Generate YouTube Links
Let’s look at the script, and we’ll break down the C# 11 features used to generate the output.
The first part of the script asks the developer for a videoId
and the timestamps
in a raw string literal. From there, we parse each row of the string literal and generate the links to each timestamp. Finally, in my case, I write out the output to the console.
If you’re getting started creating YouTube content, you might find this code helpful for parsing timestamps and posting links to video segments on your social media platforms.
Enjoy!