Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { init, getVideo, getEndScreen, setEndScreen, endScreen } = require('youtube-studio');
- const {
- SID,
- HSID,
- SSID,
- APISID,
- SAPISID,
- } = require('./cookies')
- const VIDEO_ID = 'V91KGSHbmDs'
- const CHANNEL_ID = 'UCM5rDUGQR9E2I8Y466m6RCg'
- const initialize = async () => {
- return init({
- SID,
- HSID,
- SSID,
- APISID,
- SAPISID
- }).then(() => {
- console.log("Connected!")
- })
- }
- initialize().then(async () => {
- // Get Video Endscreen (works well)
- // const endScreen = await getEndScreen(VIDEO_ID)
- // console.log(endScreen.endscreens)
- // console.log(endScreen.endscreens[0].elements)
- // Set Video Endscreen
- const videoLengthSec = 682
- const TWENTY_SEC_BEFORE_END_MS = (videoLengthSec - 20) * 1000
- const result = await setEndScreen(VIDEO_ID, TWENTY_SEC_BEFORE_END_MS, [
- { ...endScreen.TYPE_RECENT_UPLOAD }, // recent upload in top left position
- { ...endScreen.POSITION_BOTTOM_RIGHT, ...endScreen.TYPE_SUBSCRIBE(CHANNEL_ID) }, // subscribe button
- { ...endScreen.POSITION_TOP_RIGHT, ...endScreen.TYPE_BEST_FOR_VIEWERS, ...endScreen.DELAY(500) }, // best for viewers delayed with 0.5 sec
- ]).catch((err) => {
- console.log(err)
- })
- console.log(JSON.stringify(result, null, 4))
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement