Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.






                package main

import (


var (
        query      = flag.String("query", "Google", "Search term")
        maxResults = flag.Int64("max-results", 25, "Max YouTube results")

const developerKey = "YOUR DEVELOPER KEY"

func main() {

        client := &http.Client{
                Transport: &transport.APIKey{Key: developerKey},

        service, err := youtube.New(client)
        if err != nil {
                log.Fatalf("Error creating new YouTube client: %v", err)

        // Make the API call to YouTube.
        call := service.Search.List("id,snippet").
        response, err := call.Do()
        handleError(err, "")

        // Group video, channel, and playlist results in separate lists.
        videos := make(map[string]string)
        channels := make(map[string]string)
        playlists := make(map[string]string)

        // Iterate through each item and add it to the correct list.
        for _, item := range response.Items {
                switch item.Id.Kind {
                case "youtube#video":
                        videos[item.Id.VideoId] = item.Snippet.Title
                case "youtube#channel":
                        channels[item.Id.ChannelId] = item.Snippet.Title
                case "youtube#playlist":
                        playlists[item.Id.PlaylistId] = item.Snippet.Title

        printIDs("Videos", videos)
        printIDs("Channels", channels)
        printIDs("Playlists", playlists)

// Print the ID and title of each result in a list as well as a name that
// identifies the list. For example, print the word section name "Videos"
// above a list of video search results, followed by the video ID and title
// of each matching video.
func printIDs(sectionName string, matches map[string]string) {
        fmt.Printf("%v:\n", sectionName)
        for id, title := range matches {
                fmt.Printf("[%v] %v\n", id, title)