Back to APIs list![mux avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvdXBsb2FkZWQvaW1nXzJjbVN2YXl6Y2NmNnpGQmpycGtEVDlSVVRTdSJ9)
![pdebie avatar](https://avatars.githubusercontent.com/u/2958?v=4)
![nbbaier avatar](https://secure.gravatar.com/avatar/0129a541b7b3574e92c4afd06c5e32da&d=identicon)
![taras avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvb2F1dGhfZ2l0aHViL2ltZ18yYmpLdHhWY2t6b1lwdXlxZUpTc09WUDVZQngifQ)
YouTube API examples & templates
Use these vals as a playground to view and fork YouTube API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
youTubeCommentWatcher
@mux
Cron
YouTube Comment Watcher Only a few people on the team were getting the comment updates from YouTube, but we wanted everyone to see them just in case. This monitors all the YouTube videos in our channel and sends out an email whenever we get a new comment so the team can pop in if they need to. Usage Set the environment variables for YOUTUBE_API_KEY and YOUTUBE_CHANNEL_ID Fork this Go
publishYoutubeToLemmy
@pdebie
Script
Publish a Youtube feed to Lemmy This allows you to automatically publish a Youtube channel to to a Lemmy community. Example usage: async function publishMyFeed() {
try {
return @pdebie.publishYoutubeToLemmy({
instance: "lemm.ee",
auth: @me.secrets.lemmee,
communityId: 23316,
youtubeChannelId: "UChZgikssAJkmiQOv_sO-ngQ",
lastSyncTime: @pdebie.spacexLemmyDb.lastSync,
});
}
finally {
@pdebie.spacexLemmyDb.lastSync = new Date().toISOString();
}
} Get a Youtube channel ID here . Make sure to set your lastSync properly, since otherwise you'll keep publishing new posts!
getVideoInfo
@nbbaier
Script
Get YT Video Information Given a youtube video url, this val returns a small amount of information about the video: title, channel title, and the description. It uses the Youtube Data API v3, so you need to bring your own API key to get it to work (see here about setting up an API key).
scrape2md
@taras
HTTP
This is a deno/valtown port in progress of https://github.com/tarasglek/scrape2md License: MIT Handy script to scrape various data sources into markdown. Intended to feed llms in https://chatcraft.org Usage:
https://taras-scrape2md.web.val.run/ + URL_TO_SCRAPE Or just visit in browser and paste your url TODO https://chatcraft.org/api/share/tarasglek/IDYChVAilfePgVZb_T5pH POST from browser
https://www.val.town/v/nbbaier/valToGH sync to github Metadata for use with https://github.com/tarasglek/valtown2js: {
"typeCheck": false,
"mappings": {
"https://esm.sh/linkedom": {
"name": "linkedom",
"version": "^0.16.8"
}
},
"package": {
"name": "scrape2md",
"version": "1.0.0",
"devDependencies": {
"@types/turndown": "^5.0.4"
}
}
}