Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Twitterへの画像投稿でエラーが返却される #6

Closed
huequica opened this issue May 15, 2021 · 1 comment
Closed

[Bug] Twitterへの画像投稿でエラーが返却される #6

huequica opened this issue May 15, 2021 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@huequica
Copy link
Member

なにがおきてる

Youtubeのサムネイルを取得してシンメトリー画像を作り(ここまでは想定通りのはず), TwitterのAPIに画像をアップロードするところでいくつかの画像がAPIから棄却される
返却されてるエラーは以下の media type unrecognized のもの

$ ts-node --files src/symmetryYoutubeThumbs.ts
データベースを検索中
videoId: 8rUgR3PeV7w を処理します
videoId: c5wzDadfq00 を処理します
Wrote 1st image.
Wrote 2nd image.
Wrote 1st image.
Wrote 2nd image.
Wrote 1st image.
Wrote 2nd image.
{
  statusCode: 400,
  data: '{"request":"\\/1.1\\/media\\/upload.json","error":"media type unrecognized."}'
}
{
  statusCode: 400,
  data: '{"request":"\\/1.1\\/media\\/upload.json","error":"media type unrecognized."}'
}
media Upload Success 1393289793715335169
media Upload Success 1393289793765732354
media Upload Success 1393289793908338688
media Upload Success 1393289794331971584
media Upload Success 1393289795820916737
media Upload Success 1393289796508733440
media Upload Success 1393289808315781122

あやしいところ

  • src/modules/generateImages.ts
    • これちゃんとbase64の画像として正しく返せてる?
    • ヤケクソになってこの中で Twitter API にアップロードしてもダメだったのは何?
  • src/modules/makeSymmetryImages.ts
    • generateTweetsImage() で元画像を含めた base64の画像群(3つ)を配列に格納して返却
    • これが元凶の可能性はあんまりないと思う
@huequica huequica added help wanted Extra attention is needed bug Something isn't working labels May 15, 2021
@huequica
Copy link
Member Author

huequica commented May 16, 2021

検証の結果, Jimpの吐き出してる画像がかなりの確率で蹴られることがわかったので image-js に乗せかえで実装する
これでなんとかなればいいんだがなあ

https://www.npmjs.com/package/image-js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant