1
當我使用YouTube數據API上傳蟒蛇的視頻,我用這個代碼從樣本的Python腳本設置參數:我如何通過才能使用Youtube API
argparser.add_argument("--file", required=True, help="Video file to upload")
argparser.add_argument("--title", help="Video title", default="Test Title")
argparser.add_argument("--description", help="Video description",
default="Test Description")
argparser.add_argument("--category", default="22",
help="Numeric video category. " +
"See https://developers.google.com/youtube/v3/docs/videoCategories/list")
argparser.add_argument("--keywords", help="Video keywords, comma separated",
default="")
argparser.add_argument("--privacyStatus", choices=VALID_PRIVACY_STATUSES,
default=VALID_PRIVACY_STATUSES[0], help="Video privacy status.")
args = argparser.parse_args()
這意味着我必須將所有參數,如 - 文件, - 標題, - 描述等直接從命令行。我想從腳本中設置它們。我該怎麼做呢?
編輯:解決,使所需=假
當你說從腳本設置他們,這是否意味着使用默認值,如果沒有提供? – dashiell
好,如果這樣會工作,那麼我猜,但我不認爲你可以設置默認的視頻路徑? –
即使您嘗試向文件錯誤添加默認參數,您也會得到此錯誤:需要以下參數: - 文件 –