This repository was archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathSubreddit.swift
585 lines (483 loc) · 24.3 KB
/
Subreddit.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
//
// Subreddit.swift
// reddift
//
// Created by generator.rb via from https://github.com/reddit/reddit/wiki/JSON
// Created at 2015-04-15 11:23:32 +0900
//
import Foundation
import HTMLSpecialCharacters
#if os(iOS) || os(tvOS)
import UIKit
#elseif os(macOS)
import Cocoa
#endif
extension ReddiftColor {
public class func color(with hexString: String) -> ReddiftColor {
let hexString = hexString.replacingOccurrences(of: "#", with: "")
let scanner = Scanner(string: hexString)
var color: UInt32 = 0
if scanner.scanHexInt32(&color) {
let r = CGFloat((color & 0xFF0000) >> 16) / 255.0
let g = CGFloat((color & 0x00FF00) >> 8) / 255.0
let b = CGFloat(color & 0x0000FF) / 255.0
return ReddiftColor(red: r, green: g, blue: b, alpha: 1)
} else {
return ReddiftColor.white
}
}
public func hexString(_ includeAlpha: Bool = false) -> String {
var r: CGFloat = 0
var g: CGFloat = 0
var b: CGFloat = 0
var a: CGFloat = 0
self.getRed(&r, green: &g, blue: &b, alpha: &a)
if includeAlpha {
return String(format: "#%02X%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255), Int(a * 255))
} else {
return String(format: "#%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255))
}
}
}
/// Protocol to integrate a code for subreddit and multireddit.
public protocol SubredditURLPath {
var path: String {get}
}
/**
Subreddit object.
*/
public struct Subreddit: SubredditURLPath, Thing, Created {
/// identifier of Thing like 15bfi0.
public let id: String
/// name of Thing, that is fullname, like t3_15bfi0.
public let name: String
/// type of Thing, like t3.
public static let kind = "t5"
/**
example:
*/
public let bannerImg: String
/**
example: true
*/
public let userSrThemeEnabled: Bool
/**
example: <!-- SC_OFF --><div class="md"><p><strong>GIFs are banned.</strong>
If you want to post a GIF, please <a href="http://imgur.com">rehost it as a GIFV</a> instead. <a href="http://www.reddit.com/r/woahdude/wiki/html5">(Read more)</a></p>
<p><strong>Link flair is mandatory.</strong>
Click &quot;Add flair&quot; button after you submit. The button will be located under your post title. <a href="http://www.reddit.com/r/woahdude/wiki/index#wiki_flair_is_mandatory">(read more)</a></p>
<p><strong>XPOST labels are banned.</strong>
Crossposts are fine, just don&#39;t label them as such. <a href="http://www.reddit.com/r/woahdude/wiki/index#wiki_.5Bxpost.5D_tags.2Flabels_are_banned">(read more)</a></p>
<p><strong>Trippy or Mesmerizing content only!</strong>
What is WoahDude-worthy content? <a href="http://www.reddit.com/r/woahdude/wiki/index#wiki_what_is_.22woahdude_material.22.3F">(Read more)</a></p>
</div><!-- SC_ON -->
*/
public let submitTextHtml: String
/**
whether the logged-in user is banned from the subreddit
example: false
*/
public let userIsBanned: Bool
/**
example: **GIFs are banned.**
If you want to post a GIF, please [rehost it as a GIFV](http://imgur.com) instead. [(Read more)](http://www.reddit.com/r/woahdude/wiki/html5)
**Link flair is mandatory.**
Click "Add flair" button after you submit. The button will be located under your post title. [(read more)](http://www.reddit.com/r/woahdude/wiki/index#wiki_flair_is_mandatory)
**XPOST labels are banned.**
Crossposts are fine, just don't label them as such. [(read more)](http://www.reddit.com/r/woahdude/wiki/index#wiki_.5Bxpost.5D_tags.2Flabels_are_banned)
**Trippy or Mesmerizing content only!**
What is WoahDude-worthy content? [(Read more)](http://www.reddit.com/r/woahdude/wiki/index#wiki_what_is_.22woahdude_material.22.3F)
*/
public let submitText: String
/**
human name of the subreddit
example: woahdude
*/
public let displayName: String
/**
full URL to the header image, or null
example: http://b.thumbs.redditmedia.com/fnO6IreM4s_Em4dTIU2HtmZ_NTw7dZdlCoaLvtKwbzM.png
*/
public let headerImg: String
/**
sidebar text, escaped HTML format
example: <!-- SC_OFF --><div class="md"><h5><a href="https://www.reddit.com/r/woahdude/comments/2qi1jh/best_of_rwoahdude_2014_results/?">Best of WoahDude 2014 ⇦</a></h5>
<p><a href="#nyanbro"></a></p>
<h4><strong>What is WoahDude?</strong></h4>
<p><em>The best links to click while you&#39;re stoned!</em> </p>
<p>Trippy &amp; mesmerizing games, video, audio &amp; images that make you go &#39;woah dude!&#39;</p>
<p>No one wants to have to sift through the entire internet for fun links when they&#39;re stoned - so make this your one-stop shop!</p>
<p>⇨ <a href="http://www.reddit.com/r/woahdude/wiki/index#wiki_what_is_.22woahdude_material.22.3F">more in-depth explanation here</a> ⇦</p>
<h4><strong>Filter WoahDude by flair</strong></h4>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair:picture&amp;sort=top&amp;restrict_sr=on">picture</a> - Static images</p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair:wallpaper+OR+%5BWALLPAPER%5D&amp;sort=top&amp;restrict_sr=on">wallpaper</a> - PC or Smartphone</p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair%3Agifv+OR+flair%3Awebm&amp;restrict_sr=on&amp;sort=top&amp;t=all">gifv</a> - Animated images</p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair:audio&amp;sort=top&amp;restrict_sr=on">audio</a> - Non-musical audio </p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair:music&amp;sort=top&amp;restrict_sr=on">music</a> - Include: Band &amp; Song Title</p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair:musicvideo&amp;sort=top&amp;restrict_sr=on">music video</a> - If slideshow, tag [music] </p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair:video&amp;sort=top&amp;restrict_sr=on">video</a> - Non-musical video</p>
<p><a href="http://redd.it/29owi1#movies">movies</a> - Movies</p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair:game&amp;restrict_sr=on&amp;sort=top&amp;t=all">game</a> - Goal oriented games</p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair%3Ainteractive+OR+sandbox&amp;sort=top&amp;restrict_sr=on&amp;t=all">interactive</a> - Interactive pages</p>
<p><a href="http://www.reddit.com/r/woahdude/comments/1jri9s/woahdude_featured_apps_get_free_download_codes/">mobile app</a> - Mod-curated selection of apps</p>
<p><a href="http://www.reddit.com/r/WoahDude/search?q=flair%3Atext&amp;restrict_sr=on&amp;sort=top&amp;t=all">text</a> - Articles, selfposts &amp; textpics</p>
<p><a href="http://www.reddit.com/r/woahdude/search?q=flair%3Awoahdude%2Bapproved&amp;sort=new&amp;restrict_sr=on&amp;t=all">WOAHDUDE APPROVED</a> - Mod-curated selection of the best WoahDude submissions.</p>
<h4>RULES <a href="http://www.reddit.com/r/woahdude/wiki">⇨ FULL VERSION</a></h4>
<blockquote>
<ol>
<li>LINK FLAIR <strong>is <a href="http://www.reddit.com/r/woahdude/wiki/index#wiki_flair_is_mandatory">mandatory</a>.</strong></li>
<li>XPOST <strong>labels are <a href="http://www.reddit.com/r/woahdude/wiki/index#wiki_.5Bxpost.5D_tags.2Flabels_are_banned">banned</a>. Crossposts are fine, just don&#39;t label them as such.</strong></li>
<li> NO <strong>hostility!</strong> PLEASE <strong>giggle like a giraffe :)</strong></li>
</ol>
</blockquote>
<p>Certain reposts are allowed. <a href="http://www.reddit.com/r/woahdude/wiki/index#wiki_reposts">Learn more</a>. Those not allowed may be reported via this form:</p>
<p><a href="http://www.reddit.com/message/compose?to=%2Fr%2Fwoahdude&amp;subject=Repost%20Report&amp;message=Here%20%5bLINK%5d%20is%20an%20illegitimate%20repost,%20and%20here%20%5bLINK%5d%20is%20proof%20that%20the%20original%20woahdude%20post%20had%201500%2b%20upvotes.#reportwarning"></a> <a href="http://www.reddit.com/message/compose?to=%2Fr%2Fwoahdude&amp;subject=Repost%20Report&amp;message=Here%20%5bLINK%5d%20is%20an%20illegitimate%20repost,%20and%20here%20%5bLINK%5d%20is%20proof%20that%20the%20original%20woahdude%20post%20had%201500%2b%20upvotes."><strong>REPORT AN ILLEGITIMATE REPOST</strong></a></p>
<h4>WoahDude community</h4>
<ul>
<li><a href="/r/WoahDude">/r/WoahDude</a> - All media</li>
<li><a href="/r/WoahTube">/r/WoahTube</a> - Videos only</li>
<li><a href="/r/WoahTunes">/r/WoahTunes</a> - Music only</li>
<li><a href="/r/StonerPhilosophy">/r/StonerPhilosophy</a> - Text posts only</li>
<li><a href="/r/WoahPoon">/r/WoahPoon</a> - NSFW</li>
<li><strong><a href="http://www.reddit.com/user/rWoahDude/m/woahdude">MULTIREDDIT</a></strong></li>
</ul>
<h5><a href="http://facebook.com/rWoahDude"></a></h5>
<h5><a href="http://twitter.com/rWoahDude"></a></h5>
<h5><a href="http://emilydavis.bandcamp.com/track/sagans-song">http://emilydavis.bandcamp.com/track/sagans-song</a></h5>
</div><!-- SC_ON -->
*/
public let descriptionHtml: String
/**
title of the main page
example: The BEST links to click while you're STONED
*/
public let title: String
/**
example: true
*/
public let collapseDeletedComments: Bool
/**
whether the subreddit is marked as NSFW
example: false
*/
public let over18: Bool
/**
example: <!-- SC_OFF --><div class="md"><p>The best links to click while you&#39;re stoned!</p>
<p>Trippy, mesmerizing, and mindfucking games, video, audio &amp; images that make you go &#39;woah dude!&#39;</p>
<p>If you like to look at amazing stuff while smoking weed or doing other drugs, come inside for some Science, Philosophy, Mindfucks, Math, Engineering, Illusions and Cosmic weirdness.</p>
</div><!-- SC_ON -->
*/
public let publicDescriptionHtml: String
/**
example:
*/
public let iconSize: [Int]
/**
example:
*/
public let iconImg: String
/**
description of header image shown on hover, or null
example: Turn on the stylesheet and click Carl Sagan's head
*/
public let headerTitle: String
/**
sidebar text
example: #####[Best of WoahDude 2014 ⇦](https://www.reddit.com/r/woahdude/comments/2qi1jh/best_of_rwoahdude_2014_results/?)
[](#nyanbro)
####**What is WoahDude?**
*The best links to click while you're stoned!*
Trippy & mesmerizing games, video, audio & images that make you go 'woah dude!'
No one wants to have to sift through the entire internet for fun links when they're stoned - so make this your one-stop shop!
⇨ [more in-depth explanation here](http://www.reddit.com/r/woahdude/wiki/index#wiki_what_is_.22woahdude_material.22.3F) ⇦
####**Filter WoahDude by flair**
[picture](http://www.reddit.com/r/woahdude/search?q=flair:picture&sort=top&restrict_sr=on) - Static images
[wallpaper](http://www.reddit.com/r/woahdude/search?q=flair:wallpaper+OR+[WALLPAPER]&sort=top&restrict_sr=on) - PC or Smartphone
[gifv](http://www.reddit.com/r/woahdude/search?q=flair%3Agifv+OR+flair%3Awebm&restrict_sr=on&sort=top&t=all) - Animated images
[audio](http://www.reddit.com/r/woahdude/search?q=flair:audio&sort=top&restrict_sr=on) - Non-musical audio
[music](http://www.reddit.com/r/woahdude/search?q=flair:music&sort=top&restrict_sr=on) - Include: Band & Song Title
[music video](http://www.reddit.com/r/woahdude/search?q=flair:musicvideo&sort=top&restrict_sr=on) - If slideshow, tag [music]
[video](http://www.reddit.com/r/woahdude/search?q=flair:video&sort=top&restrict_sr=on) - Non-musical video
[movies](http://redd.it/29owi1#movies) - Movies
[game](http://www.reddit.com/r/woahdude/search?q=flair:game&restrict_sr=on&sort=top&t=all) - Goal oriented games
[interactive](http://www.reddit.com/r/woahdude/search?q=flair%3Ainteractive+OR+sandbox&sort=top&restrict_sr=on&t=all) - Interactive pages
[mobile app](http://www.reddit.com/r/woahdude/comments/1jri9s/woahdude_featured_apps_get_free_download_codes/) - Mod-curated selection of apps
[text](http://www.reddit.com/r/WoahDude/search?q=flair%3Atext&restrict_sr=on&sort=top&t=all) - Articles, selfposts & textpics
[WOAHDUDE APPROVED](http://www.reddit.com/r/woahdude/search?q=flair%3Awoahdude%2Bapproved&sort=new&restrict_sr=on&t=all) - Mod-curated selection of the best WoahDude submissions.
####RULES [⇨ FULL VERSION](http://www.reddit.com/r/woahdude/wiki)
> 1. LINK FLAIR **is [mandatory](http://www.reddit.com/r/woahdude/wiki/index#wiki_flair_is_mandatory).**
2. XPOST **labels are [banned](http://www.reddit.com/r/woahdude/wiki/index#wiki_.5Bxpost.5D_tags.2Flabels_are_banned). Crossposts are fine, just don't label them as such.**
3. NO **hostility!** PLEASE **giggle like a giraffe :)**
Certain reposts are allowed. [Learn more](http://www.reddit.com/r/woahdude/wiki/index#wiki_reposts). Those not allowed may be reported via this form:
[](http://www.reddit.com/message/compose?to=%2Fr%2Fwoahdude&subject=Repost%20Report&message=Here%20%5bLINK%5d%20is%20an%20illegitimate%20repost,%20and%20here%20%5bLINK%5d%20is%20proof%20that%20the%20original%20woahdude%20post%20had%201500%2b%20upvotes.#reportwarning) [**REPORT AN ILLEGITIMATE REPOST**](http://www.reddit.com/message/compose?to=%2Fr%2Fwoahdude&subject=Repost%20Report&message=Here%20%5bLINK%5d%20is%20an%20illegitimate%20repost,%20and%20here%20%5bLINK%5d%20is%20proof%20that%20the%20original%20woahdude%20post%20had%201500%2b%20upvotes.)
####WoahDude community
* /r/WoahDude - All media
* /r/WoahTube - Videos only
* /r/WoahTunes - Music only
* /r/StonerPhilosophy - Text posts only
* /r/WoahPoon - NSFW
* **[MULTIREDDIT](http://www.reddit.com/user/rWoahDude/m/woahdude)**
#####[](http://facebook.com/rWoahDude)
#####[](http://twitter.com/rWoahDude)
#####http://emilydavis.bandcamp.com/track/sagans-song
*/
public let description: String
/**
the subreddit's custom label for the submit link button, if any
example: SUBMIT LINK
*/
public let submitLinkLabel: String
/**
number of users active in last 15 minutes
example:
*/
public let accountsActive: Int
/**
whether the subreddit's traffic page is publicly-accessible
example: false
*/
public let publicTraffic: Bool
/**
width and height of the header image, or null
example: [145, 60]
*/
public let headerSize: [Int]
/**
the number of redditors subscribed to this subreddit
example: 778611
*/
public let subscribers: Int
/**
the subreddit's custom label for the submit text button, if any
example: SUBMIT TEXT
*/
public let submitTextLabel: String
/**
whether the logged-in user is a moderator of the subreddit
example: false
*/
public let userIsModerator: Bool
/**
example: 1254666760
*/
public let created: Int
/**
The relative URL of the subreddit. Ex: "/r/pics/"
example: /r/woahdude/
*/
public let url: String
/**
example: false
*/
public let hideAds: Bool
/**
example: 1254663160
*/
public let createdUtc: Int
/**
example:
*/
public let bannerSize: [Int]
/**
whether the logged-in user is an approved submitter in the subreddit
example: false
*/
public let userIsContributor: Bool
/**
Description shown in subreddit search results?
example: The best links to click while you're stoned!
Trippy, mesmerizing, and mindfucking games, video, audio & images that make you go 'woah dude!'
If you like to look at amazing stuff while smoking weed or doing other drugs, come inside for some Science, Philosophy, Mindfucks, Math, Engineering, Illusions and Cosmic weirdness.
*/
public let publicDescription: String
/**
number of minutes the subreddit initially hides comment scores
example: 0
*/
public let commentScoreHideMins: Int
/**
the subreddit's type - one of "public", "private", "restricted", or in very special cases "gold_restricted" or "archived"
example: public
*/
public let subredditType: String
/**
the type of submissions the subreddit allows - one of "any", "link" or "self"
example: any
*/
public let submissionType: String
/**
whether the logged-in user is subscribed to the subreddit
example: true
*/
public let userIsSubscriber: Bool
/**
show thumbnail images of content
example: false
*/
public let showMedia: Bool
/**
expand media previews on comments pages
example: false
*/
public let showMediaPreview: Bool
/**
enabled to use wiki of the subreddit.
example: false
*/
public let wikiEnabled: Bool
/**
*/
public let userIsMuted: Bool
public let language: String
public let keyColor: ReddiftColor
public let quarantine: Bool
public var path: String {
return "/r/\(displayName)"
}
public init(subreddit: String) {
self.id = "dummy"
self.name = "\(Subreddit.kind)_\(self.id)"
bannerImg = ""
userSrThemeEnabled = false
submitTextHtml = ""
userIsBanned = false
submitText = ""
displayName = subreddit
headerImg = ""
descriptionHtml = ""
title = ""
collapseDeletedComments = false
over18 = false
publicDescriptionHtml = ""
iconSize = []
iconImg = ""
headerTitle = ""
description = ""
submitLinkLabel = ""
accountsActive = 0
publicTraffic = false
headerSize = []
subscribers = 0
submitTextLabel = ""
userIsModerator = false
created = 0
url = ""
hideAds = false
createdUtc = 0
bannerSize = []
userIsContributor = false
publicDescription = ""
commentScoreHideMins = 0
subredditType = ""
submissionType = ""
userIsSubscriber = false
showMedia = false
showMediaPreview = false
wikiEnabled = false
userIsMuted = false
language = "en"
keyColor = ReddiftColor.white
quarantine = false
}
public init(id: String) {
self.id = id
self.name = "\(Subreddit.kind)_\(self.id)"
bannerImg = ""
userSrThemeEnabled = false
submitTextHtml = ""
userIsBanned = false
submitText = ""
displayName = ""
headerImg = ""
descriptionHtml = ""
title = ""
collapseDeletedComments = false
over18 = false
publicDescriptionHtml = ""
iconSize = []
iconImg = ""
headerTitle = ""
description = ""
submitLinkLabel = ""
accountsActive = 0
publicTraffic = false
headerSize = []
subscribers = 0
submitTextLabel = ""
userIsModerator = false
created = 0
url = ""
hideAds = false
createdUtc = 0
bannerSize = []
userIsContributor = false
publicDescription = ""
commentScoreHideMins = 0
subredditType = ""
submissionType = ""
userIsSubscriber = false
showMedia = false
showMediaPreview = false
wikiEnabled = false
userIsMuted = false
language = "en"
keyColor = ReddiftColor.white
quarantine = false
}
/**
Parse t5 object.
- parameter data: Dictionary, must be generated parsing "t5".
- returns: Subreddit object as Thing.
*/
public init(json data: JSONDictionary) {
id = data["id"] as? String ?? ""
bannerImg = data["banner_img"] as? String ?? ""
userSrThemeEnabled = data["user_sr_theme_enabled"] as? Bool ?? false
let tempSubmitTextHtml = data["submit_text_html"] as? String ?? ""
submitTextHtml = tempSubmitTextHtml.unescapeHTML
userIsBanned = data["user_is_banned"] as? Bool ?? false
submitText = data["submit_text"] as? String ?? ""
displayName = data["display_name"] as? String ?? ""
headerImg = data["header_img"] as? String ?? ""
let tempDescriptionHtml = data["description_html"] as? String ?? ""
descriptionHtml = tempDescriptionHtml.unescapeHTML
title = data["title"] as? String ?? ""
collapseDeletedComments = data["collapse_deleted_comments"] as? Bool ?? false
over18 = data["over18"] as? Bool ?? false
let tempPublicDescriptionHtml = data["public_description_html"] as? String ?? ""
publicDescriptionHtml = tempPublicDescriptionHtml.unescapeHTML
iconSize = data["icon_size"] as? [Int] ?? []
iconImg = data["icon_img"] as? String ?? ""
headerTitle = data["header_title"] as? String ?? ""
let tempDescription = data["description"] as? String ?? ""
description = tempDescription.unescapeHTML
submitLinkLabel = data["submit_link_label"] as? String ?? ""
accountsActive = data["accounts_active"] as? Int ?? 0
publicTraffic = data["public_traffic"] as? Bool ?? false
headerSize = data["header_size"] as? [Int] ?? []
subscribers = data["subscribers"] as? Int ?? 0
submitTextLabel = data["submit_text_label"] as? String ?? ""
userIsModerator = data["user_is_moderator"] as? Bool ?? false
name = data["name"] as? String ?? ""
created = data["created"] as? Int ?? 0
url = data["url"] as? String ?? ""
hideAds = data["hide_ads"] as? Bool ?? false
createdUtc = data["created_utc"] as? Int ?? 0
bannerSize = data["banner_size"] as? [Int] ?? []
userIsContributor = data["user_is_contributor"] as? Bool ?? false
let tempPublicDescription = data["public_description"] as? String ?? ""
publicDescription = tempPublicDescription.unescapeHTML
commentScoreHideMins = data["comment_score_hide_mins"] as? Int ?? 0
subredditType = data["subreddit_type"] as? String ?? ""
submissionType = data["submission_type"] as? String ?? ""
userIsSubscriber = data["user_is_subscriber"] as? Bool ?? false
showMedia = data["show_media"] as? Bool ?? false
showMediaPreview = data["show_media_preview"] as? Bool ?? false
wikiEnabled = data["wiki_enabled"] as? Bool ?? false
userIsMuted = data["user_is_muted"] as? Bool ?? false
language = data["lang"] as? String ?? "en"
let colorHex = data["key_color"] as? String ?? "#FFFFFF"
keyColor = ReddiftColor.color(with: colorHex)
quarantine = data["quarantine"] as? Bool ?? false
}
}