1
0

atproto を更新

syui 2024-08-17 10:32:12 +00:00
parent 61e4a20773
commit 0852f616ad

@ -92,36 +92,9 @@ $ cat ~/.config/ai/token.toml|dasel -r toml host
> feed = at://did:plc:4hqjfn7m6n5hno3doamuhgef/app.bsky.feed.generator/cmd
```rust
```sh
// https://docs.bsky.app/docs/api/app-bsky-feed-get-feed
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 client = reqwest::Client::new();
let res = client
.get(url)
.query(&[("feed", feed)])
.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;
}
}
}
token=`cat ~/.config/ai/token.json|jq -r .accessJwt`
url=at://did:plc:4hqjfn7m6n5hno3doamuhgef/app.bsky.feed.generator/cmd
curl -sL "https://public.api.bsky.app/xrpc/app.bsky.feed.getFeed?feed=$url" -H "Authorization: Bearer $token"
```