Skip to content

Commit 782c26d

Browse files
SteppermanStepperman
authored andcommitted
GetSubreddit is now Subreddit and way faster.
1 parent d1dfa61 commit 782c26d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

RedditSharp/Things/Post.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Security.Authentication;
5-
using System.Text.RegularExpressions;
65
using System.Threading.Tasks;
76
using System.Web;
87
using Newtonsoft.Json;
@@ -124,6 +123,9 @@ public Comment[] Comments
124123
[JsonProperty("title")]
125124
public string Title { get; set; }
126125

126+
[JsonProperty("subreddit")]
127+
public string Subreddit { get; set; }
128+
127129
[JsonProperty("url")]
128130
[JsonConverter(typeof(UrlParser))]
129131
public Uri Url { get; set; }
@@ -153,14 +155,6 @@ public Comment Comment(string message)
153155
return new Comment().Init(Reddit, json["json"]["data"]["things"][0], WebAgent, this);
154156
}
155157

156-
public string GetSubreddit()
157-
{
158-
Reddit reddit = new Reddit();
159-
string substring = Permalink.ToString();
160-
Match match = Regex.Match(substring, @"/r/.*?(?=/)");
161-
return match.Value;
162-
}
163-
164158
private string SimpleAction(string endpoint)
165159
{
166160
if (Reddit.User == null)

0 commit comments

Comments
 (0)