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

Can't post tweet with image #125

Open
OneSecure opened this issue Nov 13, 2021 · 3 comments · May be fixed by #130
Open

Can't post tweet with image #125

OneSecure opened this issue Nov 13, 2021 · 3 comments · May be fixed by #130

Comments

@OneSecure
Copy link

OneSecure commented Nov 13, 2021

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
Copy link

How are you trying to upload the image?

@OneSecure
Copy link
Author

OneSecure commented May 21, 2022

look

let bytes = std::fs::read(path)?;
let handle = upload_media(&bytes, &typ, &config.token).await?;
tweet.add_media(handle.id.clone());
if let Some(alt) = &args.alt_text {
set_metadata(&handle.id, alt, &config.token).await?;
}
println!("Media uploaded");

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

@dwrensha dwrensha linked a pull request Sep 13, 2022 that will close this issue
@dwrensha
Copy link

Fixed by #130.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants