Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(function (resolve, reject) {
var youtube = Promise.promisifyAll(gapi.youtube({version: 'v3', auth: client}).videos);
youtube.insertAsync(
{
part: 'status,snippet',
resource: {
snippet: {
title: title,
description: desc,
tags: tags,
categoryId: 20 // Category may change depending on region https://developers.google.com/youtube/v3/docs/videoCategories/list
},
status: {
privacyStatus: 'public'
}
},
media: {
import sh from 'shelljs';
import queue from 'queue';
import Google from 'googleapis';
const {OAuth2} = Google.auth;
import {fileExists} from './utils.js';
import credentials from "./secret/credentials.json";
import {
products,
projectTitle, playlistDescription, videoTitle, videoDescription, videoTags,
outPath, origFPS, finalFPS, speed
} from './config.js';
import {parseTimeStr, niceDate} from './utils.js';
// shared Youtube singleton
const Youtube = Google.youtube("v3");
makePlaylists();
function makePlaylists() {
//const makePlaylistTitle = (product) => `${projectTitle}: ${product.title}`;
//const makePlaylistDescription = product => `${playlistDescription.replace("<title>", product.title)}`;
authenticateYoutube(credentials, './secret/token.json', (oauth2Client) => {
const makeTitle = (product) => `${projectTitle}: ${product.title}`;
const makeDescription = product => `${playlistDescription.replace("<TITLE>", product.title)}`;
ensurePlaylistsForProducts(products, () => {
uploadVideosForProducts(products);
}, {makeTitle, makeDescription});
});
}
function ensurePlaylistsForProducts(products, callback, {makeTitle, makeDescription=()=>''}={}) {</title>
See the License for the specific language governing permissions and
limitations under the License.
*/
'use strict';
var API_KEY = process.env.googleapikey;
var google = require('googleapis');
google.options({
auth: API_KEY,
userId: process.env.googleuserid
});
var youtube = google.youtube('v3');
var MAXRESULTS = 50; // for YouTube Data API requests
var FUDGEFACTOR = 20; // see below: YouTube Data API totalResuls is an estimate :(
var moment = require('moment');
var request = require('request');
var account = process.env.cloudantaccount;
var password = process.env.cloudant;
var dbName = 'shearch';
var cloudantUrl = 'https://' + account + ':' + password + '@' + account +
'.cloudant.com/';
var dbUrl = cloudantUrl + dbName;
var dbStagingUrl = dbUrl + '-staging';
var allSpeakers;
var videos;
return new Promise(function(resolve, reject) {
var youtube = google.youtube({version: 'v3', auth: ytKey.apikey});
youtube.videos.list({
part: 'id,snippet',
id: [args.showID],
}, function(err, result) {
if (err) {
console.error('Error when using the YouTube API');
console.error(err);
return;
}
if (!result.items || result.items.length === 0) {
reject('Unable to get the YouTube data for "' + args.showID + '"');
return;
}
if (result.items.length > 1) {
var logger = require('../../logger.js');
var util = require('util');
var google = require('googleapis');
var youtube = google.youtube('v3');
var OAuth2 = google.auth.OAuth2;
var Stream = require('../core').Stream;
var Responder = require('./responder.js');
var Rotator = require('../core').Rotator;
var Fetch = require('./fetcher.js');
/**
* Manages the connection to Youtube
* @constructor
* @extends Stream
*/
var YoutubeStream = function(service, credentials, accounts, keywords) {
Stream.call(this, service, credentials, accounts, keywords);
var fs = require('fs');
var _ = require('underscore');
var google = require('googleapis');
var youtube = google.youtube('v3');
var config = require('../config/googleyoutube');
var utility = require('../constant/utility');
var OAuth2 = google.auth.OAuth2;
var oauth2Client;
var filepath = config.token_dir_path+config.token_file;
var googleyoutube = function(){
this.oauth2Client = new OAuth2(config.CLIENT_ID, config.CLIENT_SECRET, config.REDIRECT_URL);
};
googleyoutube.prototype.getAuthUrl = function(){
var options = {'scope':config.scope,'access_type':'offline','approval_prompt':'force','response_type':'code'};
return this.oauth2Client.generateAuthUrl(options);
};
googleyoutube.prototype.getToken = function(code){
export const statusStreamLiveStream = async ({
id,
access_token,
refresh_token,
clientId,
clientSecret,
}) => {
const auth = new OAuth2(clientId, clientSecret);
auth.setCredentials({
access_token,
refresh_token,
});
const youtube = google.youtube({ version: 'v3', auth });
const result = await p((resolve) => youtube.liveStreams.list({
part: 'id,status',
id,
}, resolve));
return result.items && result.items[0].status.streamStatus;
};
export const setBroadcastStatus = ({
id,
access_token,
refresh_token,
clientId,
clientSecret,
status,
}) => {
const auth = new OAuth2(clientId, clientSecret);
auth.setCredentials({
access_token,
refresh_token,
});
const youtube = google.youtube({ version: 'v3', auth });
return p((resolve) => youtube.liveBroadcasts.transition({
part: 'id,status',
id,
broadcastStatus: status,
}, resolve));
};
'use strict'
const passport = require('passport')
const GoogleStrategy = require('passport-google-oauth20').Strategy
const settings = require('../src/lib/settings')
const localStorage = require('../src/lib/localstorage')
const google = require('googleapis')
const youtube = google.youtube('v3')
const mmmagic = require('mmmagic')
const magic = new mmmagic.Magic(mmmagic.MAGIC_MIME_TYPE)
var youtubeSession = JSON.parse(localStorage.getItem('youtube-session')) || { accessToken: '', refreshToken: '' }
var userProfile = JSON.parse(localStorage.getItem('youtube-profile')) || {}
const loginURL = settings.actions.youtube.loginURL || '/login/youtube'
const callbackURL = settings.actions.youtube.callbackURL || '/login/youtube/return'
const failureURL = settings.actions.youtube.failureURL || '/?failure=youtube'
const successURL = settings.actions.youtube.successURL || '/?success=youtube'
const profileURL = settings.actions.youtube.profileURL || '/profile/youtube'
let privacyStatus = settings.actions.youtube.privacyStatus || 'public'
var googleAuth = new google.auth.OAuth2(
settings.actions.youtube.clientID,
settings.actions.youtube.clientSecret,
const goog = require('googleapis');
const yt = goog.youtube({ version: 'v3' });
const moment = require('moment');
let apiKey = '';
module.exports.init = function (b) {
b.getConfig('google.json', (err, conf) => {
if (!err) {
apiKey = conf.apiKey;
}
});
};
const ytRegex = /(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?/ ]{11})/i;
function formatPt50(pt50) {
const duration = moment.duration(pt50);