Skip to content

Instantly share code, notes, and snippets.

@Scrxtchy
Created August 23, 2018 12:21
Show Gist options
  • Save Scrxtchy/ab56bea9c6da3bbef83e732e9e0aa5e6 to your computer and use it in GitHub Desktop.
Save Scrxtchy/ab56bea9c6da3bbef83e732e9e0aa5e6 to your computer and use it in GitHub Desktop.
line sticker dl
import requests, json, sys, tempfile, shutil, pathlib, os, zipfile, re
#TODO: Animated and Audio files
sID = sys.argv[1]
meta = requests.get('http://dl.stickershop.line.naver.jp/products/0/0/1/{0}/android/productInfo.meta'.format(sID)).json()
meta['title']['en'] = re.sub(r'[:"%\/<>\^\|\?]', '_', meta['title']['en'])
print (meta['title']['en'])
with tempfile.TemporaryDirectory() as dlfl:
for sticker in meta['stickers']:
print("Downloading sticker #{0}".format(sticker['id']))
image = requests.get("https://sdl-stickershop.line.naver.jp/products/0/0/1/{0}/android/stickers/{1}.png".format(sID, sticker['id']))
if image.status_code == 200:
with open (pathlib.Path(dlfl, "{0}.png".format(sticker['id'])), 'wb') as file:
file.write(image.content)
with zipfile.ZipFile('{}.zip'.format(meta['title']['en']), mode='w') as dlzp:
for root, dirs, files in os.walk(dlfl):
for sticker in files:
dlzp.write(os.path.join(root, sticker), sticker)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment