使用卷曲上传每日动态视频



我正在尝试使用curl将视频从谷歌云端硬盘获取到日常运动。 我是新手。

我第一次登录使用:curl --用户名:密码 http://www.dailymotion.com/然后按照指南进行操作有了这个:

curl --request POST 
 --header "Authorization: Bearer ${ACCESS_TOKEN}" 
 --form 'url=<VIDEO_URL>' 
 --form 'title=Dailymotion cURL upload test' 
 --form 'tags=dailymotion,api,sdk,test' 
 --form 'channel=videogames' 
 --form 'published=true' 
 "api url"

但它给了我错误"代码":400,"消息":"无效的授权标头格式。有人可以帮忙吗?

如何获取访问令牌?代码看起来有效,但给定错误消息,访问令牌必须不正常。在提供的代码中,必须将${ACCESS_TOKEN}替换为实际的访问令牌。

若要获取访问令牌,可以:

  • 请按照此文档了解身份验证 https://developer.dailymotion.com/api#authentication
  • 或者,您可以简单地测试以从 API 资源管理器创建一个 https://developer.dailymotion.com/tools

试试这个:

curl -v https://api.dailymotion.com/oauth/token 
  -H "Content-Type: application/x-www-form-urlencoded" 
  -d "grant_type=password" 
  -d "client_id=<API_KEY>" 
  -d "client_secret=<API_SECRET>" 
  -d "username=<USER_USERNAME>" 
  -d "password=<USER_PASSWORD>"

您的ACCESS_TOKEN将以 JSON 格式生成:

{
  "access_token": "YOUR ACCESS_TOKEN",
  "token_type": "Bearer",
  "expires_in": 36000,
  "refresh_token": "xxxxxxxxxxx",
  "scope": "read",
  "uid": "Your uid"
}

复制生成的access_token字段并将其用于您的模式。

curl -H "Authorization: Bearer YOUR ACCESS_TOKEN" 
     "https://api.dailymotion.com/file/upload"

最新更新