-
-
Save xatier/971e1abe16f3bcbc51d9 to your computer and use it in GitHub Desktop.
extract stickers to WebP format from LINE.app cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
##################################################### | |
## LINE stickers extractor | |
## | |
## extract stickers to WebP format from LINE.app cache | |
## | |
## Author: @xatierlikelee | |
## License: GPL | |
###################################################### | |
# | |
# | |
# | |
# 1. pull all LINE stickers from you phone | |
# | |
# adb pull /storage/sdcard0/Android/data/jp.naver.line.android/stickers/ | |
# | |
# 2. execute this script | |
# | |
# ./s.pl | |
# | |
# 3. the preview of extracted stickers will be in ./previews | |
# the extracted stickers will be packed in ./packs | |
# | |
###################################################### | |
use 5.018; | |
mkdir "previews"; | |
my @dirs = glob("./stickers/*"); | |
for my $dir (@dirs) { | |
my $id = (split /\//, $dir)[-1]; | |
for my $file (glob("$dir/*")) { | |
if ($file =~ /preview/) { | |
say "extracting preview $file"; | |
system "cp $file ./previews/$id.png"; | |
} | |
} | |
} | |
mkdir "packs"; | |
for (glob("./previews/*")) { | |
my $id = (split /\//, (substr $_, 0, -4))[-1]; | |
say "extracting ID $id => ./packs/$id"; | |
mkdir "./packs/$id"; | |
system "cp ./stickers/$id/* ./packs/$id/ ;" . | |
"cd ./packs/$id/ ;" . | |
"rm *_key preview thumbnail *.tmp ;" . | |
'for i in *; do cwebp $i -o $i.webp ; done ;' . | |
'for i in `ls | grep -v webp`; do mv $i $i.png; done ;' . | |
"cd ../../"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment