reddit-rss
reddit-rss copied to clipboard
Exclude flair
It would be awesome to be able to see all entries except certain flairs.
Do you know a sub that uses a lot of flares I can use to test this feature?
Not sure if it qualifies as "a lot" but https://old.reddit.com/r/polska/ uses them (and AFAIR requires)
I for the life of me couldn't get it to work with multiple values, but this seemed to work for blocking a single flair. @trashhalo maybe this could work?
var flair string
flairStr, hasFlair := r.URL.Query()["flair"]
if hasFlair {
flair = flairStr[0]
}
var blockflair string
blockflairStr, hasblockflair := r.URL.Query()["blockflair"]
if hasblockflair {
blockflair = blockflairStr[0]
}
loader := articleLoader(client, getArticle)
var thunks []dataloader.Thunk
for _, link := range result.Data.Children {
if hasSafe && safe && (link.Data.Over18 || strings.ToLower(link.Data.LinkFlairText) == "nsfw") {
continue
}
if scoreLimit && limit > link.Data.Score {
continue
}
if hasFlair && flair != "" && link.Data.LinkFlairText != flair {
continue
}
if hasblockflair && blockflair != "" && link.Data.LinkFlairText == blockflair {
continue
}
thunks = append(thunks, loader.Load(ctx, dataKey(link.Data)))
}