CrustyJew / RedditSharp-DEPRECATED-

Reddit API wrapper for .NET
MIT License
215 stars 75 forks source link

Comment class is missing Permalink #119

Closed zmarty closed 6 years ago

zmarty commented 7 years ago

I cannot seem to find a Permalink in the Comment class.

Example expected URL: https://www.reddit.com/r/teslamotors/comments/6ujtwe/weekly_thread_index/dm0u4y1/

I am using NuGet 2.0.0-CI00028

justcool393 commented 7 years ago

Unfortunately, it's not part of the reddit JSON (which is lame in my opinion). Does the Shortlink property work for your needs?

CrustyJew commented 7 years ago

Could it be derived based on post id and the comment id? The post title isn't actually necessary and can be filled with ... instead. For example,

https://www.reddit.com/r/funny/comments/78amfn/.../dosltoc/

is perfectly valid

chuggafan commented 7 years ago

It is perfectally able to be dervied from the comment id and post id, actually, I have been using it on my bot for awhile now, and have literally just come up for a use case for myself for this, the format is specifically able to be found Here if you want to look at my code and it's surroundings, but the key code that is relevant is:

string postID = comment.LinkId.Substring(3);
string commentLink = $"https://www.reddit.com/comments/{postID}/_/{comment.Id}";
justcool393 commented 7 years ago

So, this is what I believe the Shortlink property on the comment does. It's kinda weird. I guess in theory Shortlink would be derived from Permalink but either one works.

justcool393 commented 7 years ago

https://www.reddit.com/r/redditdev/comments/78yqit/reddit_change_comment_models_returned_by_the_api/

Well that's convenient for this issue.


Okay, well this issue is an easy fix where PRAW's is broken. I'll submit a PR soon for this.

zmarty commented 6 years ago

@CrustyJew Did this change make it into MyGet? RedditSharp 2.0.0-CI00056 does not seem to have it.

CrustyJew commented 6 years ago

It should have but I'll have to double check.

zmarty commented 6 years ago

@CrustyJew As far as I can tell VotableThing in 56 does not have Permalink. I noticed the MyGet badge says Failed, could it be related?