egg-mode-rs / egg-mode

a twitter api crate for rust
https://crates.io/crates/egg-mode
Mozilla Public License 2.0
371 stars 65 forks source link

Can't post tweet with image #125

Open OneSecure opened 2 years ago

OneSecure commented 2 years ago

Hi friends, I‘m try this crate and I can post a text tweet success. But when I use examples/create_tweet.rs file to post a image jpg file, I always failed.

how do i do it right?

I run with this command cargo run --example create_tweet -- "Some image" --alt-text "alt text" --media "/home/ubuntu/a.jpg"

the error info is

Waiting for media to finish processing..Error: TwitterError(

{
  "date": "Fri, 12 Nov 2021 08:13:28 GMT",
  "vary": "Origin",
  "pragma": "no-cache",
  "server": "tsa_a",
  "status": "404 Not Found",
  "expires": "Tue, 31 Mar 1981 05:00:00 GMT",
  "set-cookie": "personalization_id=\"kkkkkk==\"; Max-Age=63072000; Expires=Sun, 12 Nov 2023 08:13:28 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None",
  "set-cookie": "lang=en; Path=/",
  "set-cookie": "guest_id=v1%hhhh; Max-Age=63072000; Expires=Sun, 12 Nov 2023 08:13:28 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None",
  "content-type": "application/json;charset=utf-8",
  "cache-control": "no-cache, no-store, must-revalidate, pre-check=0, post-check=0",
  "last-modified": "Fri, 12 Nov 2021 08:13:28 GMT",
  "x-transaction": "ccc2fbfac7b4fa36",
  "content-length": "68",
  "x-access-level": "read-write",
  "x-frame-options": "SAMEORIGIN",
  "x-xss-protection": "1; mode=block",
  "content-disposition": "attachment; filename=json.json",
  "timing-allow-origin": "https: //twitter .com, https: //mobile.twitter .com",
  "x-twitter-response-tags": "BouncerCompliant",
  "strict-transport-security": "max-age=631138519",
  "x-response-time": "15",
  "x-connection-hash": "ddddddd"
},

TwitterErrors { errors: [TwitterErrorCode { message: "Sorry, that page does not exist", code: 34 }] })
SaltySpaghetti commented 2 years ago

How are you trying to upload the image?

OneSecure commented 2 years ago

look

https://github.com/egg-mode-rs/egg-mode/blob/6a11c89eb4b66a8f66ec38b65cb95169151dfb12/examples/create_tweet.rs#L46-L52

I do nothing, just run the demo app. but it's failed.

dwrensha commented 2 years ago

Fixed by #130.