Greetings I want to make a program where if you give an Url it'll extracts the files and saves them.
For example a tweet with 4 images extract those 4 images and not the ones from the comments. If you pass a video it'll download that video and so on.
I used Reqwest to make some GET request but I don't know how to get the specific that I want.
It sounds like you have to know how the twitter website is laid out to do that, and program your application to recognize the things it should download.
Then a more simple use case and i'll go from there. How can i get a image from a Url that is just the image like url/file.png?
1 Like
You can store the entire image file into memory with Response::bytes
.
let image_file = reqwest::blocking::get("https://www.rust-lang.org")?
.bytes()?;
You can also give it a writer and tell it to write it to there directly with Response::copy_to
.
let mut file = File::create("my_file.png");
let file_len = reqwest::blocking::get("https://www.rust-lang.org")?
.copy_to(&mut file)?;
1 Like
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.