add bot custom feed
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s

This commit is contained in:
2024-04-13 02:05:05 +09:00
parent 5d60645c0f
commit 840320d0d2
13 changed files with 845 additions and 13 deletions

33
src/feed_get.rs Normal file
View File

@ -0,0 +1,33 @@
extern crate reqwest;
use crate::data_refresh;
use crate::url;
pub async fn get_request(feed: String) -> String {
let token = data_refresh(&"access");
let url = url(&"feed_get");
let feed = feed.to_string();
//let col = "app.bsky.feed.generator".to_string();
let client = reqwest::Client::new();
let res = client
.get(url)
.query(&[("feed", feed)])
//.query(&[("feed", feed), ("collection", col)])
.header("Authorization", "Bearer ".to_owned() + &token)
.send()
.await
.unwrap();
let status_ref = res.error_for_status_ref();
match status_ref {
Ok(_) => {
return res.text().await.unwrap();
}
Err(_e) => {
let e = "err".to_string();
return e;
}
}
}