-
Notifications
You must be signed in to change notification settings - Fork 14
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
EOF while parsing a value #101
Comments
Hi! That implies that the response from Reddit's API is failing to deserialize into JSON here. If you'd like to try it out yourself you could debug this by cloning this repo and updating that line to use It might be a good improvement to |
@andrewbanchich sorry for the long time replying. I did this: diff --git a/src/things/post.rs b/src/things/post.rs
index b404e4e..25ed2d9 100644
--- a/src/things/post.rs
+++ b/src/things/post.rs
@@ -167,6 +167,17 @@ pub async fn list(client: &Client, config: &Config) -> impl Stream<Item = Post>
let uri = format!("https://reddit.com/user/{username}/submitted.json{query_params}");
+ let res1 = client
+ .get(&uri)
+ .header("User-Agent", user_agent.clone())
+ .send()
+ .await
+ .unwrap()
+ .text()
+ .await
+ .unwrap();
+ dbg!(res1);
+
let res: PostRes = client
.get(&uri)
.header("User-Agent", user_agent.clone())
@@ -177,6 +188,7 @@ pub async fn list(client: &Client, config: &Config) -> impl Stream<Item = Post>
.await
.unwrap();
+
match res {
PostRes::Success { data } => {
And I got this result:
|
That's... interesting. Reddit's API is responding with an empty body. Can you try to |
@andrewbanchich sure: diff --git a/src/things/post.rs b/src/things/post.rs
index b404e4e..7904876 100644
--- a/src/things/post.rs
+++ b/src/things/post.rs
@@ -167,6 +167,16 @@ pub async fn list(client: &Client, config: &Config) -> impl Stream<Item = Post>
let uri = format!("https://reddit.com/user/{username}/submitted.json{query_params}");
+ let res1 = client
+ .get(&uri)
+ .header("User-Agent", user_agent.clone())
+ .send()
+ .await
+ .unwrap();
+
+ let headers = res1.headers();
+ dbg!(headers);
+
let res: PostRes = client
.get(&uri)
.header("User-Agent", user_agent.clone())
@@ -177,6 +187,7 @@ pub async fn list(client: &Client, config: &Config) -> impl Stream<Item = Post>
.await
.unwrap();
+
match res {
PostRes::Success { data } => {
output:
|
I've stumbled upon the same issue I think.
|
This tool works for a while, then I eventually get this error:
Let me know if there is anything I can do to help you debug this. I'm dabbling with rust as part of my job lately.
My version was installed from
cargo
, I believe:The text was updated successfully, but these errors were encountered: