gdr / bitmoji (public) (License: GPLv3) (since 2017-01-25) (hash sha1)
Download all your bitmoji emoticons, with a nice live search HTML page
List of commits:
Subject Hash Author Date (UTC)
initial 9714ddc23ee6ee973cc3cb8f2e73fd3eed4d00b3 GDR! 2016-11-06 21:59:34
Commit 9714ddc23ee6ee973cc3cb8f2e73fd3eed4d00b3 - initial
Author: GDR!
Author date (UTC): 2016-11-06 21:59
Committer name: GDR!
Committer date (UTC): 2016-11-06 21:59
Parent(s):
Signing key:
Tree: e0b99e995f3d41a22c7d171145313265a06f56cb
File Lines added Lines deleted
bitmoji.html 52 0
notes.txt 78 0
update_json.py 82 0
File bitmoji.html added (mode: 100644) (index 0000000..81199c3)
1 <html>
2 <head>
3 <style>
4 .emoji {
5 max-width: 33%;
6 }
7 </style>
8 </head>
9 <body>
10 <header id="header"></header>
11 <div id="results">
12 {% for image in images %}
13 <img src="{{ image.src }}" data-tags="{{ ','.join(image.tags) }}" class="emoji">
14 {% endfor %}
15 </div>
16 <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
17 <script>
18
19 (function ($) {
20 jQuery.expr[':'].Contains = function(a,i,m){
21 return (a.getAttribute("data-tags")).toUpperCase().indexOf(m[3].toUpperCase())>=0;
22 };
23
24 function listFilter(header, list) {
25 var form = $("<form>").attr({"class":"filterform","action":"#"}),
26 input = $("<input>").attr({"class":"filterinput","type":"text"});
27 $(form).append(input).appendTo(header);
28
29 $(input)
30 .change( function () {
31 var filter = $(this).val();
32 if(filter) {
33 $(list).find(".emoji:not(:Contains(" + filter + "))").hide();
34 $(list).find(".emoji:Contains(" + filter + ")").show();
35 } else {
36 $(list).find(".emoji").show();
37 }
38 return false;
39 })
40 .keyup( function () {
41 $(this).change();
42 });
43 }
44
45 $(function () {
46 listFilter($("#header"), $("#results"));
47 });
48 }(jQuery));
49
50 </script>
51 </body>
52 </html>
File notes.txt added (mode: 100644) (index 0000000..f9fffe0)
1 1.
2
3 curl -v -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36" -H 'Content-Type: application/json' -d '{"client_id":"imoji","username":"bitmojire@gdr.name","password":"test1234","grant_type":"password","client_secret":"secret"}' -X POST https://api.bitmoji.com/user/login
4
5 {"token_type":"bearer","access_token":"d047eb95c06922fedfb88d24e6fd71dfeb164368"}
6
7 2.
8
9 Cookie: bitmoji_bsauth_token=d047eb95c06922fedfb88d24e6fd71dfeb164368
10
11 curl -v -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36" -H 'Content-Type: application/json' -H 'Cookie: bitmoji_bsauth_token=d047eb95c06922fedfb88d24e6fd71dfeb164368' https://api.bitmoji.com/content/templates
12
13 3.
14
15 curl -v -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36" -H 'Content-Type: application/json' -H 'Cookie: bitmoji_bsauth_token=d047eb95c06922fedfb88d24e6fd71dfeb164368' -H 'bitmoji-token: d047eb95c06922fedfb88d24e6fd71dfeb164368' https://api.bitmoji.com/user/avatar
16
17 {"avatar_id":206259971,"avatar_version":1,"id":"206259971_1-s1","bsauth":true,"style":1,"gender":1,"id_hash":"d3J30xz"}
18
19 ID mozna interpolowac w obrazkach z content/template!
20
21 /
22
23 endpoints: {
24 BITMOJI_API: "https://api.bitmoji.com/",
25 BITMOJI_COM_URL: "https://www.bitmoji.com/account/",
26 RENDERING_ENDPOINT: "https://render.bitstrips.com/",
27 FORGOT_PASSWORD_ENDPOINT: "https://www.bitmoji.com/support/reset-password.html"
28 },
29 options: {
30 LANDING_TAB_AFTER_LOGIN: "popular"
31 },
32 storage: {
33 RECENTS_KEY: "recents"
34 },
35 events: {
36 RECENTS_CHANGED: "RECENTS_CHANGED",
37 BITMOJIS_LOADED: "BITMOJIS_LOADED"
38 },
39
40 v = "bitmoji",
41 m = "ios",
42
43
44 h = c.endpoints.BITMOJI_API + "user/login",
45 p = c.endpoints.BITMOJI_API + "user",
46 v = c.endpoints.BITMOJI_API + "user/exchange-tokens",
47
48 /* LOGIN - get token - store as variable "e" */
49 function i(e, t) {
50 return new Promise(function(n, r) {
51 var i = {
52 client_id: "imoji",
53 username: e,
54 password: t,
55 grant_type: "password",
56 client_secret: "secret"
57 };
58 a.ajax({
59 url: h,
60 method: "POST",
61 dataType: "json",
62 data: i,
63 error: function(e) {
64 try {
65 e = JSON.parse(e.responseText)
66 } catch (t) {
67 e = {
68 description: "Unexpected error."
69 }
70 }
71 r(e.description)
72 },
73 success: function(e) {
74 return e.error ? void r(e.error) : (m = e.access_token, l.set(u.BITMOJI_BSAUTH_COOKIE, e.access_token), void n(e.access_token))
75 }
76 })
77 })
78 }
File update_json.py added (mode: 100644) (index 0000000..3af6570)
1 #!/usr/bin/python
2
3 import jinja2
4 import json
5 import os
6 import requests
7
8 def login(username, password):
9 headers = {
10 "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36",
11 "Content-Type": "application/json",
12 }
13 body = {
14 "client_id":"imoji",
15 "username":username,
16 "password":password,
17 "grant_type": "password",
18 "client_secret":"secret"
19 }
20 r = requests.post(
21 "https://api.bitmoji.com/user/login",
22 headers=headers,
23 data=json.dumps(body),
24 )
25 print r.json()
26 r.raise_for_status()
27 response = r.json()
28 return response['access_token']
29
30
31 def get_templates(token):
32 headers = {
33 "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36",
34 "Content-Type": "application/json",
35 "Cookie": "bitmoji_bsauth_token=" + token,
36 }
37 r = requests.get("https://api.bitmoji.com/content/templates", headers=headers)
38 r.raise_for_status()
39 rv = r.json()
40 if 'imoji' not in rv:
41 print r.json()
42 return rv
43
44 def get_avatar_id(token):
45 headers = {
46 "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36",
47 "Content-Type": "application/json",
48 "Cookie": "bitmoji_bsauth_token=" + token,
49 "bitmoji-token": token,
50 }
51 r = requests.get("https://api.bitmoji.com/user/avatar", headers=headers)
52 r.raise_for_status()
53 return r.json()['id']
54
55 def generate_html(images, avatar_id):
56 for image in images:
57 image['src'] = image['src'] % avatar_id
58
59 images.sort(key=lambda x: x['category_rank'] * x['download_order'])
60 env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.getcwd()))
61 template = env.get_template("bitmoji.html")
62 rendered = template.render(images=images)
63 open("index.html", "w").write(rendered)
64
65
66 def generate_page(username, password):
67 token = login(username, password)
68 avatar_id = get_avatar_id(token)
69 # avatar_id = "206259971_1-s1"
70 templates = get_templates(token)
71 images = templates['imoji']
72 for pack in templates['packs']:
73 for emo in pack['templates']:
74 images.append(emo)
75 if len(images) == 0:
76 print "Zero images"
77 return
78
79 generate_html(images, avatar_id)
80
81 if __name__ == "__main__":
82 generate_page(os.getenv("username"), os.getenv("password"))
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/gdr/bitmoji

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/gdr/bitmoji

Clone this repository using git:
git clone git://git.rocketgit.com/user/gdr/bitmoji

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main