draftbit / twitter-lite

A tiny, full-featured, flexible client / server library for the Twitter API

Home Page:https://npm.im/twitter-lite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

media/upload does work for images but not with videos

faustoct1 opened this issue · comments

this code works fine with images but doesn't with videos

url = await client.post("media/upload", { media_data: data })

{
  _headers: Headers {
    [Symbol(map)]: [Object: null prototype] {
      'cache-control': [Array],
      connection: [Array],
      'content-disposition': [Array],
      'content-encoding': [Array],
      'content-length': [Array],
      'content-type': [Array],
      date: [Array],
      expires: [Array],
      'last-modified': [Array],
      pragma: [Array],
      server: [Array],
      'set-cookie': [Array],
      status: [Array],
      'strict-transport-security': [Array],
      vary: [Array],
      'x-access-level': [Array],
      'x-connection-hash': [Array],
      'x-frame-options': [Array],
      'x-rate-limit-limit': [Array],
      'x-rate-limit-remaining': [Array],
      'x-rate-limit-reset': [Array],
      'x-response-time': [Array],
      'x-transaction': [Array],
      'x-tsa-request-body-time': [Array],
      'x-twitter-response-tags': [Array],
      'x-xss-protection': [Array]
    }
  },
  request: '/1.1/media/upload.json',
  error: 'media type unrecognized.'
}

got something here

client.get(...) => {"media_id":1284554329119236000,"media_id_string":"1284554329119236097","media_key":"7_1284554329119236097","size":1939232,"processing_info":{"state":"failed","progress_percent":100,"error":{"code":1,"name":"InvalidMedia","message":"file is invalid"}},"_headers":{}}

How to get media_id_string ?