

Help="Offset in milliseconds to show video.",Īrgparser.add_argument("-offset-type", choices=VALID_OFFSET_TYPES, Help="Video ID to feature on your channel")

Help="Channel ID of the channel to add a featured video")Īrgparser.add_argument("-video-id", required=True, # You can use the API Explorer to test API requests:Īrgparser.add_argument("-channel-id", required=True, VALID_OFFSET_TYPES = ("offsetFromEnd", "offsetFromStart",)įlow = flow_from_clientsecrets(CLIENT_SECRETS_FILE, scope=YOUTUBE_SCOPE,ĭef add_featured_video(youtube, options):Īdd_video_request = youtube.channels().update( # If offsetMs is not valid, the API will throw an error O exemplo de código abaixo chama o método channels.update da API para definir propriedades invideoPromotion para o canal. Print "The bulletin was posted to your channel." Adicionar um vídeo em destaque Print "An HTTP error %d occurred:\n%s" % (e.resp.status, e.content) Youtube = get_authenticated_service(args) # However, you can't post a video and a playlist at the same time.Įxit("You cannot post a video and a playlist at the same time.") # You can post a message with or without an accompanying video or playlist. # This method calls the API's method to post theĪrgparser.add_argument("-message", required=True, Return build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, If credentials is None or credentials.invalid:Ĭredentials = run_flow(flow, storage, args) Storage = Storage("%s-oauth2.json" % sys.argv) """ % os.path.abspath(os.path.join(os.path.dirname(_file_),įlow = flow_from_clientsecrets(CLIENT_SECRETS_FILE, To make this sample run you will need to populate the client_secrets.json fileįor more information about the client_secrets.json file format, please visit: # This variable defines a message to display if the CLIENT_SECRETS_FILE is

CÓDIGO DE INSERT SCRIPTCASE FULL
# This OAuth 2.0 access scope allows for full read/write access to the # For more information about the client_secrets.json file format, see:ĬLIENT_SECRETS_FILE = "client_secrets.json" # For more information about using OAuth2 to access the YouTube Data API, see: # Please ensure that you have enabled the YouTube Data API for your project. You can acquire an OAuth 2.0 client ID and client secret from # the OAuth 2.0 information for this application, including its client_id and # The CLIENT_SECRETS_FILE variable specifies the name of a file that contains O exemplo de código abaixo chama o método activities.insert da API para publicar um boletim para o canal associado à solicitação.įrom oauth2client.client import flow_from_clientsecretsįrom oauth2client.tools import argparser, run_flow Os seguintes exemplos de código, que usam a Biblioteca de clientes de APIs do Google para Python, estão disponíveis para YouTube Data API.
