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)
Precache images 39dbcf2e596ff267f35090f1fbce2f66bfb19250 GDR! 2016-11-06 22:31:36
Better mobile look 6b2479dc91afe68a3b0c55235dc3d859cca7bf77 GDR! 2016-11-06 22:11:01
initial 9714ddc23ee6ee973cc3cb8f2e73fd3eed4d00b3 GDR! 2016-11-06 21:59:34
Commit 39dbcf2e596ff267f35090f1fbce2f66bfb19250 - Precache images
Author: GDR!
Author date (UTC): 2016-11-06 22:31
Committer name: GDR!
Committer date (UTC): 2016-11-06 22:31
Parent(s): 6b2479dc91afe68a3b0c55235dc3d859cca7bf77
Signer:
Signing key:
Signing status: N
Tree: 4c0bf0a2899ea5d1108bfc11ad01064f3d28e9e1
File Lines added Lines deleted
update_json.py 27 1
File update_json.py changed (mode: 100644) (index 8b7fc9a..7fc81c4)
3 3 import jinja2 import jinja2
4 4 import json import json
5 5 import os import os
6 import os.path
6 7 import requests import requests
8 import traceback
7 9
8 10 def login(username, password): def login(username, password):
9 11 headers = { headers = {
 
... ... def get_avatar_id(token):
51 53 r.raise_for_status() r.raise_for_status()
52 54 return r.json()['id'] return r.json()['id']
53 55
56 def precache_images(images):
57 images_dir = os.path.join(os.getcwd(), "e")
58 if not os.path.exists(images_dir):
59 os.makedirs(images_dir)
60
61 for image in images:
62 try:
63 image_path = os.path.join(images_dir, "%s.png" % image['template_id'])
64 if not os.path.exists(image_path):
65 r = requests.get(image['src'])
66 with open(image_path, "wb") as f:
67 for chunk in r.iter_content(chunk_size=4096):
68 if chunk:
69 f.write(chunk)
70
71 except:
72 traceback.print_exc()
73
74 if os.path.exists(image_path):
75 image['original_src'] = image['src']
76 image['src'] = 'e/%s.png' % image['template_id']
77
78
54 79 def generate_html(images, avatar_id): def generate_html(images, avatar_id):
55 80 for image in images: for image in images:
56 81 image['src'] = image['src'] % avatar_id image['src'] = image['src'] % avatar_id
57 82
83 precache_images(images)
84
58 85 images.sort(key=lambda x: x['category_rank'] * x['download_order']) images.sort(key=lambda x: x['category_rank'] * x['download_order'])
59 86 env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.getcwd())) env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.getcwd()))
60 87 template = env.get_template("bitmoji.html") template = env.get_template("bitmoji.html")
 
... ... def generate_html(images, avatar_id):
65 92 def generate_page(username, password): def generate_page(username, password):
66 93 token = login(username, password) token = login(username, password)
67 94 avatar_id = get_avatar_id(token) avatar_id = get_avatar_id(token)
68 # avatar_id = "206259971_1-s1"
69 95 templates = get_templates(token) templates = get_templates(token)
70 96 images = templates['imoji'] images = templates['imoji']
71 97 for pack in templates['packs']: for pack in templates['packs']:
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