Added captcha handling for Subreddit.Submit(Text)Post #64
Conversation
/// <param name="title">The title of the submission</param> | ||
/// <param name="url">The url of the submission link</param> | ||
public Post SubmitPost(string title, string url) | ||
private Post Submit(SubmitData data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking API change here! I'd rather not do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below, this is just a wrapper method that posts a request to the reddit API. The normal SubmitPost and SubmitTextPost are still there with the regular signature :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh whoops, my bad.
Can you implement a default capcha handler that prompts at the console? Also, paging @JosephDomenici for testing. |
Made the data classes internal (for now, at least), since they are only used internally anyway. |
Could you make it output the full URL to the capcha image, instead of just the ID? That should be done at a lower level, the capcha code should offer that URL to any capcha handler. |
It already is, below the line that outputs the ID there is also a line outputting the URL (available as the |
Oh, neato. I'll wait until I've heard from @JosephDomenici and then get this merged. |
@Sharparam I just tested it and I'm getting a NullReferenceException error. See pic for more information: https://mediacru.sh//KacBqNiH-W0r.png I'm pretty new, so it's quite possible that I messed something up. I can drop in IRC to help you troubleshoot if you'd like. |
…nternal properties
@SirCmpwn Would there be a problem with CreatePost including non-public properties in the post data? On reddit's side I don't think it will matter since it most likely ignores data that is not relevant. |
That's probably not a problem. @JosephDomenici, can you share your code so that someone more experienced can take a whack at debugging it? |
And just to have the info here. Lines 27-35 of Thing.cs (constructor): /* 27 */ internal Thing(JToken json)
/* 28 */ {
/* 29 */ if (json == null)
/* 30 */ return;
/* 31 */ var data = json["data"];
/* 32 */ FullName = data["name"].ValueOrDefault<string>();
/* 33 */ Id = data["id"].ValueOrDefault<string>();
/* 34 */ Kind = json["kind"].ValueOrDefault<string>();
/* 35 */ } It seems that Edit: I'm not sure how he got that far though, as the code should have thrown an |
@Sharparam I just dummied up a test program and got a similar error: ArgumentOutOfRange exception on WebAgent.WritePostBody. @SirCmpwn This is my first time using branches in git and I can't quite figure out how to include @Sharparam's test branch of RedditSharp that I used. Sorry! https://github.com/JosephDomenici/Reddit-Readability-Bot/tree/Testing |
With the latest commit you should no longer be getting To check out the patch-4 branch in this PR. You can do the following on command line:
Now the code in the repo should be updated with the one from this PR. |
@Sharparam Was having git issues so I just downloaded the .zip. Worked perfectly fine with my dummy test program, and the captcha went flawlessly. Thanks! Still getting the same NullReferenceException error with my regular program, however. Going to strip it down and see if I can figure out exactly what's causing the issue. |
My regular program is working now! Turns out I was referencing .dlls from a previous version of RedditSharp. Whoops. @SirCmpwn, it looks like everything is in order now. |
Added captcha handling for Subreddit.Submit(Text)Post
Untested, if someone could test to make sure this works, that would be great.
Edit: Requested from #45