Comments (6)
merged in #80 - facebook and messenger images are now supported
from emoji-data.
Do you have the exact image address syntax to scrape, though?
{ http
| https
}://www.facebook.com/images/emoji.php/v
{ version number ≤ 7
}/
{type: z
Messenger | f
Facebook | e
Extended | u
Unicode}{2-hexdigit checksum()}/
{single-digit pixel ratio: 1
}/
{decimal pixel width/height: 16
|18
|20
|24
|28
|30
|32
|64
|128
} /
{lowercase hexadecimal Unicode position, mostly 1f
xyz
}.png
/**
* Facebook emoji URL checksum
* @param string codepoints = "{single-digit pixel ratio}/"
* + "{decimal pixel width/height}/"
* + "{lowercase hexadecimal Unicode positions, separated by underscores}.png"
* = `\d/\d{2,3}/[a-f\d_]+\.png` (lax RX)
* = `[12]/(16|18|20|24|28|30|32|64|128)/[a-f\d]{4,5}(_[a-f\d]{4,5})*\.png` (stricter RX)
* @param int base = 317426846 (default)
* @returns string of 2 hexadecimal digits
*/
function checksum(codepoints, base) {
codepoints = b.unescape(encodeURIComponent(codepoints)); /** `unescape()`: `&` → `&`, `<` → `<`, `>` → `>`, `"` → `"`, `'` → `'` */
for (var pos = 0; pos < codepoints.length; pos++) {
base = (base << 5) - base + codepoints.charCodeAt(pos);
base &= 4294967295;
}
return (base & 255).toString(16);
}
JFTR, snippets of JS code I’m getting served today (don’t know how stable/universal):
__d('EmojiImageURL', ['invariant', 'EmojiStaticConfig', 'EmojiConfig'], (function a(b, c, d, e, f, g, h) {
function i(k, l) {
k = b.unescape(encodeURIComponent(k));
for (var m = 0; m < k.length; m++) {
l = (l << 5) - l + k.charCodeAt(m);
l &= 4294967295;
}
return (l & 255).toString(16);
}
function j(k, l, m) {
l in c('EmojiStaticConfig').supportedSizes || h(0);
var n = c('EmojiConfig').pixelRatio + '/' + l + '/' + k + c('EmojiStaticConfig').fileExt,
o = i(n, c('EmojiStaticConfig').checksumBase);
return c('EmojiConfig').schemaAuth + '/' + m + o + '/' + n;
}
f.exports = {
getMessengerURL: function k(l, m) {
return j(l, m, c('EmojiStaticConfig').types.MESSENGER);
},
getFBEmojiURL: function k(l) {
var m = arguments.length <= 1 || arguments[1] === undefined ? 16 : arguments[1];
return j(l, m, c('EmojiStaticConfig').types.FBEMOJI);
},
getFBEmojiExtendedURL: function k(l) {
var m = arguments.length <= 1 || arguments[1] === undefined ? 16 : arguments[1];
return j(l, m, c('EmojiStaticConfig').types.FB_EMOJI_EXTENDED);
}
};
}), null);
__d("EmojiStaticConfig", [], (function a(b, c, d, e, f, g) {
f.exports = {
checksumBase: 317426846,
fileExt: ".png",
supportedSizes: {
"16": "DP16",
"18": "DP18",
"20": "DP20",
"24": "DP24",
"28": "DP28",
"30": "DP30",
"32": "DP32",
"64": "DP64",
"128": "DP128"
},
types: {
FBEMOJI: "f",
FB_EMOJI_EXTENDED: "e",
MESSENGER: "z",
UNICODE: "u"
},
sizeMap: {
dp16: 16,
dp18: 18,
dp20: 20,
dp24: 24,
dp28: 28,
dp30: 30,
dp32: 32,
dp64: 64,
dp128: 128,
xsmall: 16,
small: 32,
medium: 64,
large: 128
}
};
}), null);
__d("SupportedFBEmoji", [], (function a(b, c, d, e, f, g) {
f.exports = {
"1f004": 1,
/* … flag: sequence: */
"1f1e6_1f1e8": 1,
/* … */
"1f201": 1,
/* … ???: */
"1f313_20": 1,
/* … skin tone modifier (U+1F3FB–F) sequences: */
"1f385": 1,
"1f385_1f3fb": 1,
"1f385_1f3fc": 1,
"1f385_1f3fd": 1,
"1f385_1f3fe": 1,
"1f385_1f3ff": 1,
/* … ZWJ (U+200D) sequence with optional skin tone modifier: */
"1f3c3": 1,
"1f3c3_1f3f": 1,
"1f3c3_1f3fb": 1,
"1f3c3_1f3fb_200d_2642": 1,
"1f3c3_1f3fc": 1,
"1f3c3_1f3fc_200d_2642": 1,
"1f3c3_1f3fd": 1,
"1f3c3_1f3fd_200d_2642": 1,
"1f3c3_1f3fe": 1,
"1f3c3_1f3fe_200d_2642": 1,
"1f3c3_1f3ff": 1,
"1f3c3_1f3ff_200d_2642": 1,
"1f3c3_200d_2642": 1,
/* … ZWJ sequence with optional emoji variation selector (VS-16, U+FE0F): */
"1f3f3": 1,
"1f3f3_200d_1f308": 1,
"1f3f3_fe0f_200d_1f308": 1,
/* … simple ZWJ sequence: */
"1f441": 1,
"1f441_200d_1f5e8": 1,
/* … one of many complex (family) ZWJ sequences: */
"1f468_1f3ff_200d_1f468_1f3ff_200d_1f466_1f3ff_200d_1f466_1f3ff": 1,
/* … some preliminary Unicode 10.0 characters: */
"1f997": 1,
"1f9c0": 1,
"1f9d0": 1,
"1f9e0": 1,
"1f9e2": 1,
"1f9e3": 1,
"1f9e4": 1,
/* … code point below U+1000, combining key cap (U+20E3) sequence: */
"23_20e3": 1,
"23_fe0f_20e3": 1,
/* … optional VS-16: */
"2764": 1,
"2764_fe0f": 1,
/* … */
"": 1,
a9: 1,
ae: 1
};
}), null);
__d('EmojiLikeConstants', ['EmojiStaticConfig'], (function a(b, c, d, e, f, g) {
'use strict';
var h = c('EmojiStaticConfig').sizeMap,
i = {
XSMALL: 'xsmall',
SMALL: 'small',
MEDIUM: 'medium',
LARGE: 'large'
},
j = {
dp16: 'xsmall',
dp32: 'small',
dp64: 'medium',
db64: 'medium',
dp128: 'large'
},
k = {
PICKER: 'picker',
HOT_LIKE: 'hot_like'
},
l = [983040],
m = 'hot_emoji_source',
n = 'hot_emoji_size',
o = 'emoji_like',
p = '\uD83D\uDC4D',
q = [128077];
f.exports = {
FB_THUMBS_UP_EMOJI: l,
size: i,
sizeMap: h,
sizeMapTransfer: j,
source: k,
SOURCE_TAG_PREFIX: m,
TAG_PREFIX_NEW: n,
TAG_PREFIX_OLD: o,
THUMBS_UP_EMOJI: p,
THUMBS_UP_EMOJI_CODES: q
};
}), null);
from emoji-data.
I turned that into a gist which (currently) works. Haven’t tried older versions than v7
.
from emoji-data.
messenger images have landed on master, but no facebook.com images yet
from emoji-data.
I figured it out, I guess, and updated the Gist.
Only the few Unicode 10 emojis are available with size
set to 128
. However, even those are not available at 64 pixels (despite what it says in the source code). Every emoji is available for 16
, 18
, 20
, 24
, 28
, 30
and 32
(except the missing Unicode 10 ones)! To get images larger than 32 by 32 pixels, one can increase the pixelRatio
to 1.5, 2 or 3 (othere values may work as well) – 2 × 32px make 64 pixels, but 128px is not possible. The high-resolution version can be upscaled, too, i.e. 3 × 128px = 384px.
The digit after emoji.php/v
does not seem to matter at all. Facebook itself seems to be using only v7
and v8
currently, though.
from emoji-data.
good find! i'm building the facebook set now (32, 3x -> 96px source images)
from emoji-data.
Related Issues (20)
- "sky & weather" subcategory should be in "Animals & Nature" not "Travel & Places" HOT 3
- Some emoji has wrong short code HOT 3
- Add support for Microsoft Fluent Emoji
- closed
- Handling large sets of icons?
- HD Apple emojis HOT 1
- Emoji 15.0 support HOT 7
- Q. Where does the emoji data set come from? HOT 2
- accessing the actual emojis from the json file HOT 4
- "underage" shortcode confusing and misleading
- Twemoji HOT 1
- Can we get a 30x30 pixel version too (due to the issue with 2078x2078 and we should stay below 2048x2048 texture size?) HOT 2
- Creating apple/64/simple : sh: montage: command not found HOT 1
- [v15.0.0 regression] Google set incorrectly displays 🏴 Scotland flag as 🇸🇨 Seychelles flag HOT 7
- `non_qualified` incorrectly `null` for gendered emoji HOT 1
- Updated emoji.json, to include all HOT 6
- Unified code Outdated HOT 1
- [15.1.0 regression] Twitter sheets have incorrect dimensions and misplaced emoji
- How to search for emojis with that have multiple words? Some emojis aren't found at all? HOT 2
- Emoji 15.1 sizes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emoji-data.