QuantumBadger / RedReader

An unofficial open source Android app for Reddit.
GNU General Public License v3.0
1.96k stars 482 forks source link

Support for subreddit emotes #120

Open Rroia opened 10 years ago

Rroia commented 10 years ago

There is an issue with the link detection in comments. When viewing this Comment in RedReader 1.8.3 a link gets detected despite nothing like that is in the comment.

screenshot_2013-12-01-09-28-30

Either reddit automaticly filters that part out on its website but not the api, or RedReader gets it from another comment

ajs124 commented 10 years ago

About that comment… it's a hidden emote with alttext: bildschirmfoto - 07 12 2013 - 16 44 15 The pony displayed is spitfire and the "academy record" is a brony meme. Idk if this helps, but it might clear up some confusion.

QuantumBadger commented 10 years ago

This is expected behaviour at the moment -- I might add support for emoticons in a future release (but it's fairly low on the to-do list).

QuantumBadger commented 4 years ago

With the new HTML parser, this would be pretty easy to add.

For subreddits like /r/soccer, /r/anime, etc which use them, we just need a list showing which image to display for each emote text, in a computer-readable form like CSV.

QuantumBadger commented 4 years ago

I can't find anything similar for /r/soccer, but for /r/anime this is available here: https://github.com/r-anime/comment-face-assets

The images are too large (51MB) to embed in the app. It would be possible to download directly from raw.githubusercontent.com, but I haven't been able to find if GitHub have a policy on that.

One possibility (which would work for all subreddits if done properly) would be to parse the subreddit CSS to extract reddit's image URLs:

https://old.reddit.com/r/soccer/stylesheet.css

.flair-s4,
.linkflair-s4 a.title:before,
a[href^="#sprite4"] {
 background-image:url("//b.thumbs.redditmedia.com/Pcvlz6Mrvwien35ZcVeXfd_ED8QI79o8sO420nkfXHk.png")
}
.flair-s5,
.linkflair-s5 a.title:before,
a[href^="#sprite5"] {
 background-image:url("//b.thumbs.redditmedia.com/cecCgZVpfgPIDTTL8orGvYB2fsGlL0UqNmpgDxdWk2U.png")
}
.flair-s6,
.linkflair-s6 a.title:before,
a[href^="#sprite6"] {
 background-image:url("//b.thumbs.redditmedia.com/uMGOoCOgy-V2FFuWPzb_t_381LcUMrfKUoN4upseNtk.png")
}
.flair-24,
.linkflair-24 a.title:before,
a[href$="-p24"] {
 background-position:5% 96%
}
.flair-25,
.linkflair-25 a.title:before,
a[href$="-p25"] {
 background-position:5% 100%
}
.flair-26,
.linkflair-26 a.title:before,
a[href$="-p26"] {
 background-position:10% 4%
}

That seems like a huge pain though :)