Exemplo n.º 1
0
  if credentials is None or credentials.invalid:
    credentials = run_flow(flow, storage, args)

  return build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,
    http=credentials.authorize(httplib2.Http()))


# Call the API's watermarks.unset method to remove the watermark image.
def unset_watermark(youtube, channel_id):
  try:
    youtube.watermarks().unset(channelId=channel_id).execute()
  except HttpError as e:
    print("Error while unsetting watermark: %s" % e.content)
    raise e


if __name__ == "__main__":
  argparser.add_argument("--channelid", dest="channelid",
    help="Required; id of channel whose watermark you're updating.")
  args = argparser.parse_args()

  if not args.channelid:
    argparser.print_help()
    exit()

  youtube = get_authenticated_service(args)

  unset_watermark(youtube, args.channelid)
  print("The watermark was successfully unset.")
Exemplo n.º 2
0
    raise e


if __name__ == "__main__":
  # The "channelid" option specifies the YouTube channel ID that uniquely
  # identifies the channel for which the watermark image is being updated.
  argparser.add_argument("--channelid", dest="channelid",
    help="Required; ID for channel that is having its watermark updated.")
  # The "file" option specifies the path to the image being uploaded.
  argparser.add_argument("--file", dest="file",
    help="Required; path to watermark image file.")
  # The "metadata" option specifies the JSON for the watermark resource
  # provided with the request.
  argparser.add_argument("--metadata", dest="metadata",
    help="Required; watermark metadata in JSON format.")
  args = argparser.parse_args()

  if not args.channelid:
    argparser.print_help()
    exit()

  youtube = get_authenticated_service(args)

  if not args.file or not os.path.exists(args.file):
    exit("Please specify a valid file using the --file= parameter.")
  if not args.metadata:
    exit("Please specify watermark metadata using the --metadata= parameter.")
  set_watermark(youtube, args.channelid, args.file,
                json.loads(args.metadata))
  print "The watermark was successfully set."