sticker-convert 2.12.2__py3-none-any.whl → 2.12.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sticker_convert/cli.py +2 -0
- sticker_convert/converter.py +7 -2
- sticker_convert/downloaders/download_viber.py +13 -3
- sticker_convert/gui.py +8 -0
- sticker_convert/gui_components/windows/advanced_compression_window.py +17 -0
- sticker_convert/gui_components/windows/kakao_get_auth_window.py +2 -6
- sticker_convert/job_option.py +2 -0
- sticker_convert/resources/help.json +1 -0
- sticker_convert/utils/auth/get_discord_auth.py +4 -1
- sticker_convert/utils/auth/get_kakao_desktop_auth.py +118 -34
- sticker_convert/utils/auth/telegram_api.py +2 -2
- sticker_convert/utils/chrome_remotedebug.py +31 -41
- sticker_convert/version.py +1 -1
- {sticker_convert-2.12.2.dist-info → sticker_convert-2.12.4.dist-info}/METADATA +5 -4
- {sticker_convert-2.12.2.dist-info → sticker_convert-2.12.4.dist-info}/RECORD +19 -19
- {sticker_convert-2.12.2.dist-info → sticker_convert-2.12.4.dist-info}/WHEEL +0 -0
- {sticker_convert-2.12.2.dist-info → sticker_convert-2.12.4.dist-info}/entry_points.txt +0 -0
- {sticker_convert-2.12.2.dist-info → sticker_convert-2.12.4.dist-info}/licenses/LICENSE +0 -0
- {sticker_convert-2.12.2.dist-info → sticker_convert-2.12.4.dist-info}/top_level.txt +0 -0
sticker_convert/cli.py
CHANGED
@@ -139,6 +139,7 @@ class CLI:
|
|
139
139
|
"cache_dir",
|
140
140
|
"scale_filter",
|
141
141
|
"quantize_method",
|
142
|
+
"chromium_path",
|
142
143
|
)
|
143
144
|
flags_comp_bool = ("fake_vid",)
|
144
145
|
keyword_args: Dict[str, Any]
|
@@ -427,6 +428,7 @@ class CLI:
|
|
427
428
|
fake_vid=self.compression_presets[preset]["fake_vid"]
|
428
429
|
if args.fake_vid is None
|
429
430
|
else args.fake_vid,
|
431
|
+
chromium_path=args.chromium_path,
|
430
432
|
cache_dir=args.cache_dir,
|
431
433
|
scale_filter=self.compression_presets[preset]["scale_filter"]
|
432
434
|
if args.scale_filter is None
|
sticker_convert/converter.py
CHANGED
@@ -435,15 +435,20 @@ class StickerConvert:
|
|
435
435
|
width = self.codec_info_orig.res[0]
|
436
436
|
height = self.codec_info_orig.res[1]
|
437
437
|
|
438
|
-
chrome_path
|
438
|
+
chrome_path: Optional[str]
|
439
|
+
if self.opt_comp.chromium_path:
|
440
|
+
chrome_path = self.opt_comp.chromium_path
|
441
|
+
else:
|
442
|
+
chrome_path = CRD.get_chrome_path()
|
439
443
|
args = [
|
440
444
|
"--headless",
|
445
|
+
"--kiosk",
|
441
446
|
"--disable-extensions",
|
442
447
|
"--disable-infobars",
|
443
448
|
"--disable-gpu",
|
444
449
|
"--disable-gpu-rasterization",
|
445
450
|
"--hide-scrollbars",
|
446
|
-
f"--window-size={width +
|
451
|
+
f"--window-size={width + 200},{height + 200}",
|
447
452
|
"about:blank",
|
448
453
|
]
|
449
454
|
if chrome_path is None:
|
@@ -19,7 +19,7 @@ class DownloadViber(DownloadBase):
|
|
19
19
|
# def __init__(self, *args: Any, **kwargs: Any) -> None:
|
20
20
|
# super().__init__(*args, **kwargs)
|
21
21
|
|
22
|
-
def get_pack_info(self, url: str) -> Optional[Tuple[str, str, str]]:
|
22
|
+
def get_pack_info(self, url: str) -> Optional[Tuple[str, str, str, str]]:
|
23
23
|
r = requests.get(url, allow_redirects=True)
|
24
24
|
soup = BeautifulSoup(r.text, "html.parser")
|
25
25
|
|
@@ -42,8 +42,17 @@ class DownloadViber(DownloadBase):
|
|
42
42
|
first_sticker_url = cast(str, pack_dict["stickerFirstItemUrl"])
|
43
43
|
zip_url = "/".join(first_sticker_url.split("/")[:-1]) + ".zip"
|
44
44
|
pack_id = pack_dict["id"].split(".")[-1]
|
45
|
+
if is_custom:
|
46
|
+
cover_url = (
|
47
|
+
"https://custom-sticker-pack.cdn.viber.com/custom-stickers/{}/thumb.png"
|
48
|
+
)
|
49
|
+
else:
|
50
|
+
cover_url = (
|
51
|
+
"https://sm-content.viber.com/static/images/product/{}/sticker.png"
|
52
|
+
)
|
53
|
+
cover_url = cover_url.format(pack_dict["id"])
|
45
54
|
|
46
|
-
return title, zip_url, pack_id
|
55
|
+
return title, zip_url, cover_url, pack_id
|
47
56
|
|
48
57
|
def decompress(
|
49
58
|
self, zip_file: bytes, exts: Optional[Tuple[str, ...]] = None
|
@@ -84,7 +93,7 @@ class DownloadViber(DownloadBase):
|
|
84
93
|
if pack_info is None:
|
85
94
|
self.cb.put("Download failed: Cannot get pack info")
|
86
95
|
return 0, 0
|
87
|
-
title, zip_url, pack_id = pack_info
|
96
|
+
title, zip_url, cover_url, pack_id = pack_info
|
88
97
|
|
89
98
|
anim_url = f"https://content.cdn.viber.com/stickers/ASVG/{pack_id}.zip"
|
90
99
|
anim_file = self.download_file(anim_url)
|
@@ -94,6 +103,7 @@ class DownloadViber(DownloadBase):
|
|
94
103
|
count += self.decompress(zip_file, (".mp3",))
|
95
104
|
else:
|
96
105
|
count = self.decompress(zip_file, (".mp3", ".png"))
|
106
|
+
self.download_file(cover_url, self.out_dir / "cover.png")
|
97
107
|
|
98
108
|
MetadataHandler.set_metadata(self.out_dir, title=title)
|
99
109
|
|
sticker_convert/gui.py
CHANGED
@@ -137,6 +137,7 @@ class GUI(Window):
|
|
137
137
|
self.fake_vid_var = BooleanVar()
|
138
138
|
self.scale_filter_var = StringVar(self)
|
139
139
|
self.quantize_method_var = StringVar(self)
|
140
|
+
self.chromium_path_var = StringVar(self)
|
140
141
|
self.cache_dir_var = StringVar(self)
|
141
142
|
self.default_emoji_var = StringVar(self)
|
142
143
|
self.steps_var = IntVar(self)
|
@@ -321,6 +322,7 @@ class GUI(Window):
|
|
321
322
|
"comp": {
|
322
323
|
"no_compress": self.no_compress_var.get(),
|
323
324
|
"preset": self.comp_preset_var.get(),
|
325
|
+
"chromium_path": self.chromium_path_var.get(),
|
324
326
|
"cache_dir": self.cache_dir_var.get(),
|
325
327
|
"processes": self.processes_var.get(),
|
326
328
|
},
|
@@ -377,6 +379,9 @@ class GUI(Window):
|
|
377
379
|
self.compression_presets["custom"], comp_custom
|
378
380
|
)
|
379
381
|
self.cache_dir_var.set(self.settings.get("comp", {}).get("cache_dir", ""))
|
382
|
+
self.chromium_path_var.set(
|
383
|
+
self.settings.get("comp", {}).get("chromium_path", "")
|
384
|
+
)
|
380
385
|
self.processes_var.set(
|
381
386
|
self.settings.get("comp", {}).get("processes", ceil(cpu_count() / 2))
|
382
387
|
)
|
@@ -568,6 +573,9 @@ class GUI(Window):
|
|
568
573
|
fake_vid=self.fake_vid_var.get(),
|
569
574
|
scale_filter=self.scale_filter_var.get(),
|
570
575
|
quantize_method=self.quantize_method_var.get(),
|
576
|
+
chromium_path=self.chromium_path_var.get()
|
577
|
+
if self.chromium_path_var.get() != ""
|
578
|
+
else None,
|
571
579
|
cache_dir=self.cache_dir_var.get()
|
572
580
|
if self.cache_dir_var.get() != ""
|
573
581
|
else None,
|
@@ -293,6 +293,17 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
293
293
|
bootstyle="secondary", # type: ignore
|
294
294
|
)
|
295
295
|
|
296
|
+
self.chromium_path_help_btn = self.add_help_btn(
|
297
|
+
self.gui.help["comp"]["chromium_path"]
|
298
|
+
)
|
299
|
+
self.chromium_path_lbl = Label(
|
300
|
+
self.frame_advcomp, text="Chromium/Chrome directory"
|
301
|
+
)
|
302
|
+
self.chromium_path_entry = Entry(
|
303
|
+
self.frame_advcomp, textvariable=self.gui.chromium_path_var, width=30
|
304
|
+
)
|
305
|
+
self.chromium_path_entry.bind("<Button-3><ButtonRelease-3>", RightClicker)
|
306
|
+
|
296
307
|
self.cache_dir_help_btn = self.add_help_btn(self.gui.help["comp"]["cache_dir"])
|
297
308
|
self.cache_dir_lbl = Label(self.frame_advcomp, text="Custom cache directory")
|
298
309
|
self.cache_dir_entry = Entry(
|
@@ -412,6 +423,12 @@ class AdvancedCompressionWindow(BaseWindow):
|
|
412
423
|
column=2, row=r, columnspan=4, sticky="nes", padx=3, pady=3
|
413
424
|
)
|
414
425
|
r += 1
|
426
|
+
self.chromium_path_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
427
|
+
self.chromium_path_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
428
|
+
self.chromium_path_entry.grid(
|
429
|
+
column=2, row=r, columnspan=4, sticky="nes", padx=3, pady=3
|
430
|
+
)
|
431
|
+
r += 1
|
415
432
|
self.cache_dir_help_btn.grid(column=0, row=r, sticky="w", padx=3, pady=3)
|
416
433
|
self.cache_dir_lbl.grid(column=1, row=r, sticky="w", padx=3, pady=3)
|
417
434
|
self.cache_dir_entry.grid(
|
@@ -1,6 +1,4 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
|
-
import platform
|
3
|
-
import subprocess
|
4
2
|
from functools import partial
|
5
3
|
from threading import Thread
|
6
4
|
from typing import Any, Optional
|
@@ -37,7 +35,7 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
37
35
|
# Method 1 frame
|
38
36
|
self.explanation1_1_lbl = Label(
|
39
37
|
self.frame_from_desktop,
|
40
|
-
text="This will get Kakao auth_token from Kakao Desktop
|
38
|
+
text="This will get Kakao auth_token from Kakao Desktop",
|
41
39
|
justify="left",
|
42
40
|
anchor="w",
|
43
41
|
)
|
@@ -70,14 +68,12 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
70
68
|
command=self.cb_launch_desktop,
|
71
69
|
width=24,
|
72
70
|
bootstyle="secondary", # type: ignore
|
73
|
-
state="normal" if platform.system() == "Windows" else "disabled",
|
74
71
|
)
|
75
72
|
self.get_auth_desktop_btn = Button(
|
76
73
|
self.frame_from_desktop,
|
77
74
|
text="Get auth_token",
|
78
75
|
command=self.cb_from_desktop,
|
79
76
|
width=24,
|
80
|
-
state="normal" if platform.system() == "Windows" else "disabled",
|
81
77
|
)
|
82
78
|
|
83
79
|
self.explanation1_1_lbl.grid(
|
@@ -270,7 +266,7 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
270
266
|
bin_path = m.get_kakao_desktop()
|
271
267
|
|
272
268
|
if bin_path is not None:
|
273
|
-
|
269
|
+
m.launch_kakao(bin_path)
|
274
270
|
else:
|
275
271
|
self.cb_msg_block_kakao(
|
276
272
|
"Error: Cannot launch Kakao Desktop. Is it installed?"
|
sticker_convert/job_option.py
CHANGED
@@ -75,6 +75,7 @@ class CompOption(BaseOption):
|
|
75
75
|
fake_vid: Optional[bool] = None
|
76
76
|
quantize_method: Optional[str] = None
|
77
77
|
scale_filter: Optional[str] = None
|
78
|
+
chromium_path: Optional[str] = None
|
78
79
|
cache_dir: Optional[str] = None
|
79
80
|
default_emoji: str = "😀"
|
80
81
|
no_compress: Optional[bool] = None
|
@@ -109,6 +110,7 @@ class CompOption(BaseOption):
|
|
109
110
|
"fake_vid": self.fake_vid,
|
110
111
|
"quantize_method": self.quantize_method,
|
111
112
|
"scale_filter": self.scale_filter,
|
113
|
+
"chromium_path": self.chromium_path,
|
112
114
|
"cache_dir": self.cache_dir,
|
113
115
|
"default_emoji": self.default_emoji,
|
114
116
|
"no_compress": self.no_compress,
|
@@ -52,6 +52,7 @@
|
|
52
52
|
"scale_filter": "Set scale filter. Default as bicubic. Valid options are:\n- nearest = Use nearest neighbour (Suitable for pixel art)\n- box = Similar to nearest, but better downscaling\n- bilinear = Linear interpolation\n- hamming = Similar to bilinear, but better downscaling\n- bicubic = Cubic spline interpolation\n- lanczos = A high-quality downsampling filter",
|
53
53
|
"quantize_method": "Set method for quantizing image. Default as imagequant. Valid options are:\n- imagequant = Best quality but slow\n- fastoctree = Fast but image looks chunky\n- none = No image quantizing, large image size as result",
|
54
54
|
"cache_dir": "Set custom cache directory.\nUseful for debugging, or speed up conversion if cache_dir is on RAM disk.",
|
55
|
+
"chromium_path": "Set Chromium(-based)/Chrome browser path.\nRequired for converting from SVG files.\nLeave blank to auto detect",
|
55
56
|
"default_emoji": "Set the default emoji for uploading Signal and Telegram sticker packs."
|
56
57
|
},
|
57
58
|
"cred": {
|
@@ -74,7 +74,10 @@ class GetDiscordAuth:
|
|
74
74
|
else:
|
75
75
|
chrome_path = CRD.get_chrome_path()
|
76
76
|
if chrome_path is None:
|
77
|
-
return
|
77
|
+
return (
|
78
|
+
None,
|
79
|
+
"Please install Discord Desktop or Chrome/Chromium and try again",
|
80
|
+
)
|
78
81
|
|
79
82
|
token = None
|
80
83
|
if using_discord_app:
|
@@ -18,21 +18,33 @@ then login to Kakao Desktop and try again."""
|
|
18
18
|
MSG_NO_AUTH = """Kakao Desktop installed,
|
19
19
|
but kakao_auth not found.
|
20
20
|
Please login to Kakao Desktop and try again."""
|
21
|
+
MSG_SIP_ENABLED = """You need to disable SIP:
|
22
|
+
1. Restart computer in Recovery mode
|
23
|
+
2. Launch Terminal from the Utilities menu
|
24
|
+
3. Run the command `csrutil disable`
|
25
|
+
4. Restart your computer"""
|
21
26
|
MSG_LAUNCH_FAIL = "Failed to launch Kakao"
|
22
27
|
MSG_PERMISSION_ERROR = "Failed to read Kakao process memory"
|
23
|
-
MSG_UNSUPPORTED = "Only Windows is supported for this method"
|
24
28
|
|
25
29
|
|
26
30
|
class GetKakaoDesktopAuth:
|
27
31
|
def __init__(self, cb_ask_str: Callable[..., str] = input):
|
28
32
|
self.cb_ask_str = cb_ask_str
|
29
33
|
|
34
|
+
def launch_kakao(self, kakao_bin_path: str):
|
35
|
+
if platform.system() == "Windows":
|
36
|
+
subprocess.Popen([kakao_bin_path])
|
37
|
+
elif platform.system() == "Darwin":
|
38
|
+
subprocess.Popen(["open", kakao_bin_path])
|
39
|
+
else:
|
40
|
+
subprocess.Popen(["wine", kakao_bin_path])
|
41
|
+
|
30
42
|
def relaunch_kakao(self, kakao_bin_path: str) -> Optional[int]:
|
31
43
|
killed = killall("kakaotalk")
|
32
44
|
if killed:
|
33
45
|
time.sleep(5)
|
34
46
|
|
35
|
-
|
47
|
+
self.launch_kakao(kakao_bin_path)
|
36
48
|
time.sleep(20)
|
37
49
|
|
38
50
|
return find_pid_by_name("kakaotalk")
|
@@ -54,7 +66,7 @@ class GetKakaoDesktopAuth:
|
|
54
66
|
try:
|
55
67
|
with OpenProcess(pid=int(kakao_pid)) as process:
|
56
68
|
for address in process.search_by_value( # type: ignore
|
57
|
-
str, 15, "
|
69
|
+
str, 15, "authorization: "
|
58
70
|
):
|
59
71
|
auth_token_addr = cast(int, address) + 15
|
60
72
|
auth_token_bytes = process.read_process_memory(
|
@@ -127,11 +139,77 @@ class GetKakaoDesktopAuth:
|
|
127
139
|
|
128
140
|
return auth_token, msg
|
129
141
|
|
130
|
-
def
|
131
|
-
|
132
|
-
|
142
|
+
def get_auth_darwin(self, kakao_bin_path: str) -> Tuple[Optional[str], str]:
|
143
|
+
killall("kakaotalk")
|
144
|
+
|
145
|
+
subprocess.run(
|
146
|
+
[
|
147
|
+
"lldb",
|
148
|
+
kakao_bin_path,
|
149
|
+
"-o",
|
150
|
+
"b ptrace",
|
151
|
+
"-o",
|
152
|
+
"r",
|
153
|
+
"-o",
|
154
|
+
"thread return",
|
155
|
+
"-o",
|
156
|
+
"con",
|
157
|
+
"-o",
|
158
|
+
"process save-core /tmp/memdump.kakaotalk.dmp",
|
159
|
+
"-o",
|
160
|
+
"con",
|
161
|
+
"-o",
|
162
|
+
"quit",
|
163
|
+
],
|
164
|
+
stdout=subprocess.DEVNULL,
|
165
|
+
stderr=subprocess.DEVNULL,
|
133
166
|
)
|
134
|
-
|
167
|
+
|
168
|
+
with open("/tmp/memdump.kakaotalk.dmp", "rb") as f:
|
169
|
+
mem = f.read()
|
170
|
+
|
171
|
+
os.remove("/tmp/memdump.kakaotalk.dmp")
|
172
|
+
|
173
|
+
auth_token = None
|
174
|
+
for i in re.finditer(b"]mac/", mem):
|
175
|
+
auth_token_term = i.start()
|
176
|
+
|
177
|
+
auth_token_bytes = mem[auth_token_term - 200 : auth_token_term]
|
178
|
+
auth_token_start = auth_token_bytes.find(b"application/json_\x10\x8a") + 19
|
179
|
+
if auth_token_start == -1:
|
180
|
+
continue
|
181
|
+
try:
|
182
|
+
auth_token_candidate = auth_token_bytes[auth_token_start:].decode(
|
183
|
+
encoding="ascii"
|
184
|
+
)
|
185
|
+
except UnicodeDecodeError:
|
186
|
+
continue
|
187
|
+
|
188
|
+
if 150 > len(auth_token_candidate) > 100:
|
189
|
+
auth_token = auth_token_candidate
|
190
|
+
break
|
191
|
+
|
192
|
+
if auth_token is None:
|
193
|
+
return None, MSG_NO_AUTH
|
194
|
+
else:
|
195
|
+
msg = "Got auth_token successfully:\n"
|
196
|
+
msg += f"{auth_token=}\n"
|
197
|
+
|
198
|
+
return auth_token, msg
|
199
|
+
|
200
|
+
def get_kakao_desktop(self) -> Optional[str]:
|
201
|
+
if platform.system() == "Windows":
|
202
|
+
kakao_bin_path = os.path.expandvars(
|
203
|
+
"%programfiles(x86)%\\Kakao\\KakaoTalk\\KakaoTalk.exe"
|
204
|
+
)
|
205
|
+
elif platform.system() == "Darwin":
|
206
|
+
kakao_bin_path = "/Applications/KakaoTalk.app"
|
207
|
+
else:
|
208
|
+
kakao_bin_path = os.path.expanduser(
|
209
|
+
"~/.wine/drive_c/Program Files (x86)/Kakao/KakaoTalk/KakaoTalk.exe"
|
210
|
+
)
|
211
|
+
|
212
|
+
if Path(kakao_bin_path).exists():
|
135
213
|
return kakao_bin_path
|
136
214
|
|
137
215
|
return None
|
@@ -140,15 +218,6 @@ class GetKakaoDesktopAuth:
|
|
140
218
|
self,
|
141
219
|
kakao_bin_path: Optional[str] = None,
|
142
220
|
) -> Tuple[Optional[str], str]:
|
143
|
-
if platform.system() != "Windows":
|
144
|
-
return None, MSG_UNSUPPORTED
|
145
|
-
|
146
|
-
if not kakao_bin_path:
|
147
|
-
kakao_bin_path = self.get_kakao_desktop()
|
148
|
-
|
149
|
-
if not kakao_bin_path:
|
150
|
-
return None, MSG_NO_BIN
|
151
|
-
|
152
221
|
# get_auth_by_dump()
|
153
222
|
# + Fast
|
154
223
|
# - Requires admin
|
@@ -158,23 +227,38 @@ class GetKakaoDesktopAuth:
|
|
158
227
|
# - Slow
|
159
228
|
# - Cannot run on macOS
|
160
229
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
230
|
+
if not kakao_bin_path:
|
231
|
+
kakao_bin_path = self.get_kakao_desktop()
|
232
|
+
|
233
|
+
if not kakao_bin_path:
|
234
|
+
return None, MSG_NO_BIN
|
235
|
+
|
236
|
+
if platform.system() != "Darwin":
|
237
|
+
# If admin, prefer get_auth_by_dump() over get_auth_by_pme(), vice versa
|
238
|
+
methods: List[Callable[[str, bool], Tuple[Optional[str], str]]] = []
|
239
|
+
relaunch = True
|
240
|
+
kakao_auth = None
|
241
|
+
msg = ""
|
242
|
+
|
243
|
+
pme_present = importlib.util.find_spec("PyMemoryEditor") is not None
|
244
|
+
methods.append(self.get_auth_by_dump)
|
245
|
+
if pme_present:
|
246
|
+
methods.append(self.get_auth_by_pme)
|
247
|
+
if check_admin() is False:
|
248
|
+
methods.reverse()
|
249
|
+
|
250
|
+
for method in methods:
|
251
|
+
kakao_auth, msg = method(kakao_bin_path, relaunch)
|
252
|
+
relaunch = False
|
253
|
+
if kakao_auth is not None:
|
254
|
+
break
|
255
|
+
else:
|
256
|
+
csrutil_status = subprocess.run(
|
257
|
+
["csrutil", "status"], capture_output=True, text=True
|
258
|
+
).stdout
|
259
|
+
|
260
|
+
if "enabled" in csrutil_status:
|
261
|
+
return None, MSG_SIP_ENABLED
|
262
|
+
kakao_auth, msg = self.get_auth_darwin(kakao_bin_path)
|
179
263
|
|
180
264
|
return kakao_auth, msg
|
@@ -388,8 +388,8 @@ class TelethonAPI(TelegramAPI):
|
|
388
388
|
else:
|
389
389
|
sent_message = cast(
|
390
390
|
Message,
|
391
|
-
await self.client.send_file("Stickers", msg, force_document=True),
|
392
|
-
)
|
391
|
+
await self.client.send_file("Stickers", msg, force_document=True), # type: ignore
|
392
|
+
)
|
393
393
|
|
394
394
|
for _ in range(5):
|
395
395
|
# https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this
|
@@ -8,8 +8,9 @@ import shutil
|
|
8
8
|
import socket
|
9
9
|
import subprocess
|
10
10
|
import time
|
11
|
-
from typing import Any, Dict, List, Optional, Union, cast
|
11
|
+
from typing import Any, Dict, List, Optional, Tuple, Union, cast
|
12
12
|
|
13
|
+
import browsers # type: ignore
|
13
14
|
import requests
|
14
15
|
import websocket
|
15
16
|
from PIL import Image
|
@@ -19,6 +20,23 @@ from PIL import Image
|
|
19
20
|
# https://chromedevtools.github.io/devtools-protocol/
|
20
21
|
|
21
22
|
|
23
|
+
BROWSER_PREF = [
|
24
|
+
"chrome",
|
25
|
+
"chrome-canary",
|
26
|
+
"chromium",
|
27
|
+
"msedge",
|
28
|
+
"msedge-beta",
|
29
|
+
"msedge-dev",
|
30
|
+
"msedge-canary",
|
31
|
+
"brave",
|
32
|
+
"brave-beta",
|
33
|
+
"brave-nightly",
|
34
|
+
"opera",
|
35
|
+
"opera-beta",
|
36
|
+
"opera-developer",
|
37
|
+
]
|
38
|
+
|
39
|
+
|
22
40
|
def get_free_port() -> int:
|
23
41
|
with socket.socket() as sock:
|
24
42
|
sock.bind(("", 0))
|
@@ -66,47 +84,19 @@ class CRD:
|
|
66
84
|
|
67
85
|
@staticmethod
|
68
86
|
def get_chrome_path() -> Optional[str]:
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
chrome_x64 = f"{os.environ.get('PROGRAMW6432') or os.environ.get('PROGRAMFILES')}\\Google\\Chrome\\Application"
|
80
|
-
chrome_x86 = (
|
81
|
-
f"{os.environ.get('PROGRAMFILES(X86)')}\\Google\\Chrome\\Application"
|
82
|
-
)
|
83
|
-
|
84
|
-
chrome_dir = (
|
85
|
-
chrome_x64
|
86
|
-
if os.path.isdir(chrome_x64)
|
87
|
-
else chrome_x86
|
88
|
-
if os.path.isdir(chrome_x86)
|
89
|
-
else None
|
90
|
-
)
|
91
|
-
|
92
|
-
if chrome_dir is None:
|
93
|
-
return None
|
94
|
-
|
95
|
-
return chrome_dir + "\\chrome.exe"
|
96
|
-
|
97
|
-
else:
|
98
|
-
for executable in (
|
99
|
-
"google-chrome",
|
100
|
-
"google-chrome-stable",
|
101
|
-
"google-chrome-beta",
|
102
|
-
"google-chrome-dev",
|
103
|
-
"chromium-browser",
|
104
|
-
"chromium",
|
105
|
-
):
|
106
|
-
chrome_bin = shutil.which(executable)
|
107
|
-
if chrome_bin is not None:
|
108
|
-
return chrome_bin
|
87
|
+
bs: List[Tuple[int, str]] = []
|
88
|
+
for b in browsers.browsers():
|
89
|
+
browser_type = b["browser_type"]
|
90
|
+
path = b["path"]
|
91
|
+
try:
|
92
|
+
rank = BROWSER_PREF.index(browser_type)
|
93
|
+
except ValueError:
|
94
|
+
continue
|
95
|
+
bs.append((rank, path))
|
96
|
+
if len(bs) == 0:
|
109
97
|
return None
|
98
|
+
bs = sorted(bs, key=lambda x: x[0])
|
99
|
+
return bs[0][1]
|
110
100
|
|
111
101
|
def connect(self, target_id: int = 0):
|
112
102
|
self.cmd_id = 1
|
sticker_convert/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: sticker-convert
|
3
|
-
Version: 2.12.
|
3
|
+
Version: 2.12.4
|
4
4
|
Summary: Convert (animated) stickers to/from WhatsApp, Telegram, Signal, Line, Kakao, Viber, Discord, iMessage. Written in Python.
|
5
5
|
Author-email: laggykiller <chaudominic2@gmail.com>
|
6
6
|
Maintainer-email: laggykiller <chaudominic2@gmail.com>
|
@@ -365,7 +365,7 @@ Description-Content-Type: text/markdown
|
|
365
365
|
License-File: LICENSE
|
366
366
|
Requires-Dist: aiolimiter~=1.2.1
|
367
367
|
Requires-Dist: anyio~=4.9.0
|
368
|
-
Requires-Dist: apngasm_python~=1.3.
|
368
|
+
Requires-Dist: apngasm_python~=1.3.2
|
369
369
|
Requires-Dist: av~=13.1.0
|
370
370
|
Requires-Dist: beautifulsoup4~=4.13.3
|
371
371
|
Requires-Dist: cryptg~=0.5.0.post0
|
@@ -376,12 +376,13 @@ Requires-Dist: memory-tempfile~=2.2.3
|
|
376
376
|
Requires-Dist: mergedeep~=1.3.4
|
377
377
|
Requires-Dist: numpy>=1.22.4
|
378
378
|
Requires-Dist: Pillow~=11.1.0
|
379
|
-
Requires-Dist:
|
379
|
+
Requires-Dist: pybrowsers~=0.7.0
|
380
|
+
Requires-Dist: pyoxipng~=9.1.0
|
380
381
|
Requires-Dist: python-telegram-bot~=22.0
|
381
382
|
Requires-Dist: psutil~=7.0.0
|
382
383
|
Requires-Dist: PyMemoryEditor~=1.5.22
|
383
384
|
Requires-Dist: requests~=2.32.3
|
384
|
-
Requires-Dist: rlottie_python~=1.3.
|
385
|
+
Requires-Dist: rlottie_python~=1.3.7
|
385
386
|
Requires-Dist: signalstickers-client-fork-laggykiller~=3.3.0.post2
|
386
387
|
Requires-Dist: socksio~=1.0.0
|
387
388
|
Requires-Dist: telethon~=1.39.0
|
@@ -1,12 +1,12 @@
|
|
1
1
|
sticker_convert/__init__.py,sha256=iQnv6UOOA69c3soAn7ZOnAIubTIQSUxtq1Uhh8xRWvU,102
|
2
2
|
sticker_convert/__main__.py,sha256=elDCMvU27letiYs8jPUpxaCq5puURnvcDuqGsAAb6_w,592
|
3
|
-
sticker_convert/cli.py,sha256=
|
4
|
-
sticker_convert/converter.py,sha256=
|
3
|
+
sticker_convert/cli.py,sha256=Mj_cN4CnvOBTie6vJmN-e6EostNSiRts5GR38mvgm-Q,22433
|
4
|
+
sticker_convert/converter.py,sha256=b3lJX2eTJ8OMFgAjQzbv2E8lbCclgo3yJ1dtBXmur28,39593
|
5
5
|
sticker_convert/definitions.py,sha256=BqROmOvqIqw8ANaqZXIxJAXGD0HgjAvCfFouQ4SaWHc,2254
|
6
|
-
sticker_convert/gui.py,sha256=
|
6
|
+
sticker_convert/gui.py,sha256=Lvuu9J1MPdokjlHpLctqsRTOnWv9jXvy2IjJQt0FRAk,34177
|
7
7
|
sticker_convert/job.py,sha256=gEd6yF8WPUR1_7q9SVhnwdD5usrDxwowNnR5q9uS8Yc,28011
|
8
|
-
sticker_convert/job_option.py,sha256=
|
9
|
-
sticker_convert/version.py,sha256=
|
8
|
+
sticker_convert/job_option.py,sha256=yI_uKWJEAul2XTC6pucz9PfW0iNwwOr0aVC-PAHkMA4,8109
|
9
|
+
sticker_convert/version.py,sha256=v342n9uw6gNve6meN4iu5vMOMDrABk5g9HB3zQjA5N8,47
|
10
10
|
sticker_convert/downloaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
sticker_convert/downloaders/download_base.py,sha256=MI5pCT_tkfoaFlrD1oNynDj1Rv1CK0APuNVElTEAEis,5110
|
12
12
|
sticker_convert/downloaders/download_discord.py,sha256=6AFpLAYL2hRvVcsqUtzDUC31U66U02ZcnKXDnZRi2jk,3496
|
@@ -14,7 +14,7 @@ sticker_convert/downloaders/download_kakao.py,sha256=-k9uTo_vn5CUjb0XPCKPmtYfftw
|
|
14
14
|
sticker_convert/downloaders/download_line.py,sha256=c-hTzEarGQP0b-pnPl29NuSKcaZWUeRo_94YpJzz72M,17911
|
15
15
|
sticker_convert/downloaders/download_signal.py,sha256=3wv-BLd4qggly4AdtwV8f3vUpCVZ-8GnoPLoWngY3Pk,3728
|
16
16
|
sticker_convert/downloaders/download_telegram.py,sha256=iGmOcVjU2Ai19t1lyDY2JhQIc--O5XMyNCGXZAA4DVY,2028
|
17
|
-
sticker_convert/downloaders/download_viber.py,sha256=
|
17
|
+
sticker_convert/downloaders/download_viber.py,sha256=SFnyaVEd_33J1KvRhcHDJqnLKGsbLMeA2NomVHm2ulM,4226
|
18
18
|
sticker_convert/gui_components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
sticker_convert/gui_components/gui_utils.py,sha256=okho2cA1Scem_m6rPiYifreFzpFrM21-yUkiAv64EUI,3431
|
20
20
|
sticker_convert/gui_components/frames/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -27,10 +27,10 @@ sticker_convert/gui_components/frames/output_frame.py,sha256=n2WLk22h61DoZli8WbF
|
|
27
27
|
sticker_convert/gui_components/frames/progress_frame.py,sha256=LWUZg_iL7iiNTfu7N5Ct_pklZdghxihENi7DP9YozOE,4915
|
28
28
|
sticker_convert/gui_components/frames/right_clicker.py,sha256=dGIvSzEChrkguR80pzUemBNJ39uzJjVJQKeDNUoW3Gk,721
|
29
29
|
sticker_convert/gui_components/windows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
|
-
sticker_convert/gui_components/windows/advanced_compression_window.py,sha256=
|
30
|
+
sticker_convert/gui_components/windows/advanced_compression_window.py,sha256=djJNyPodBmNhW0vHvdg6xAd7LYkVm9UINMHrRXVmr_k,32718
|
31
31
|
sticker_convert/gui_components/windows/base_window.py,sha256=xBE1peGMPvWsdrFej0CJUVhmQ57GJGvz-cX03nIIhkE,1108
|
32
32
|
sticker_convert/gui_components/windows/discord_get_auth_window.py,sha256=pUSarkXXmSr01VW9h4LgpJy7F53gw7X6ZNqunoFG-ys,2762
|
33
|
-
sticker_convert/gui_components/windows/kakao_get_auth_window.py,sha256=
|
33
|
+
sticker_convert/gui_components/windows/kakao_get_auth_window.py,sha256=1nawn_D4wkziW_lROjUJlmVtITAuGt_4uruGMcEr7Oo,11128
|
34
34
|
sticker_convert/gui_components/windows/line_get_auth_window.py,sha256=S4ES_lk2-GDvPokZtYALnUc5zW1VbS4WulNqO9K1aSs,3375
|
35
35
|
sticker_convert/gui_components/windows/signal_get_auth_window.py,sha256=lYvjADW3IRrqo065apSPZZtC2JCLXUqkX6lDWv79jyQ,3102
|
36
36
|
sticker_convert/gui_components/windows/viber_get_auth_window.py,sha256=oHL4ipivtGT35tN5wzDKhsYsihLmoLwSDgI75g2XcCs,5183
|
@@ -72,7 +72,7 @@ sticker_convert/resources/appicon.ico,sha256=-ldugcl2Yq2pBRTktnhGKWInpKyWzRjCiPv
|
|
72
72
|
sticker_convert/resources/appicon.png,sha256=6XBEQz7PnerqS43aRkwpWolFG4WvKMuQ-st1ly-_JPg,5265
|
73
73
|
sticker_convert/resources/compression.json,sha256=hZY906wUmdAuflVhUowm9EW6h40BzuD4LBNe-Mpd9V8,14184
|
74
74
|
sticker_convert/resources/emoji.json,sha256=q9DRFdVJfm7feZW7ZM6Xa5P1QsMvrn0PbBVU9jKcJKI,422720
|
75
|
-
sticker_convert/resources/help.json,sha256=
|
75
|
+
sticker_convert/resources/help.json,sha256=IDJhDD5plY8_Ze5gnM6rMs6H1-urWo94sEHeGzO5QeU,7364
|
76
76
|
sticker_convert/resources/input.json,sha256=BYHYDqMLZuQnA3MF0ViudGpkSuAG8OMS7L-7hxC3K3o,3858
|
77
77
|
sticker_convert/resources/memdump_linux.sh,sha256=YbdX5C5RyCnoeDUE6JgTo8nQXKhrUw5-kFDx5bQp9tY,651
|
78
78
|
sticker_convert/resources/memdump_windows.ps1,sha256=CfyNSSEW3HJOkTu-mKrP3qh5aprN-1VCBfj-R1fELA0,302
|
@@ -85,17 +85,17 @@ sticker_convert/uploaders/upload_telegram.py,sha256=WlUyLJlW83XZz6RhA76jHMXA6TNU
|
|
85
85
|
sticker_convert/uploaders/upload_viber.py,sha256=_vOK0UgP7V7ZeFG6pR3sVf3A744Q6J19qzO-2hDvt5w,6583
|
86
86
|
sticker_convert/uploaders/xcode_imessage.py,sha256=iTTT8gDYOTNkKqXeSWUBuWfxu7xeE418t2Z1YQFR5L0,11365
|
87
87
|
sticker_convert/utils/callback.py,sha256=spYUGlklOs1yPZAxoqwOWgR1sdimpfM8a27if3TaVYk,6155
|
88
|
-
sticker_convert/utils/chrome_remotedebug.py,sha256=
|
88
|
+
sticker_convert/utils/chrome_remotedebug.py,sha256=uzUBlUtuO0cRcDxO7hnPWvbdt5NJBnCXvAnStK2zAVQ,6445
|
89
89
|
sticker_convert/utils/emoji.py,sha256=AqB26JY-PkYzNwPLReSnqLiQKe-bR9UXnLclAbgubJ8,367
|
90
90
|
sticker_convert/utils/process.py,sha256=EAQZ9WpiKmkvToIv8G1HNY4V7m0jXyyePTmeP2XOZzE,4688
|
91
91
|
sticker_convert/utils/url_detect.py,sha256=vCbhQbcW1X_UtdfQlICGY8pMX34KQ6sCtDJZbp0NrSg,876
|
92
|
-
sticker_convert/utils/auth/get_discord_auth.py,sha256=
|
92
|
+
sticker_convert/utils/auth/get_discord_auth.py,sha256=MeyLzB8hlMTv8l2-6HBW45hppwogSH2gyI1L-VAOEkM,4273
|
93
93
|
sticker_convert/utils/auth/get_kakao_auth.py,sha256=Wok5sp0GGBgTwwlfYB7lVq82ndBAOGTcqsWEaWAXFNE,10760
|
94
|
-
sticker_convert/utils/auth/get_kakao_desktop_auth.py,sha256=
|
94
|
+
sticker_convert/utils/auth/get_kakao_desktop_auth.py,sha256=yT-gvvrKfpMRIVfmc6mfaEWSh4RKMs0B3rOD-zSI5hs,8597
|
95
95
|
sticker_convert/utils/auth/get_line_auth.py,sha256=8l8ha2vQmk3rHGvDE7PkcxQXbH3oe62LKbI3qVUtvqc,2196
|
96
96
|
sticker_convert/utils/auth/get_signal_auth.py,sha256=oDTcIUcRM8_zfmR6UoBvzBhIscwLRe7n2zw4aw0j8_Q,4564
|
97
97
|
sticker_convert/utils/auth/get_viber_auth.py,sha256=mUTrcxq5bTrzSXEVaeTPqVQIdZdwvIhrbMgBUb7dU30,8173
|
98
|
-
sticker_convert/utils/auth/telegram_api.py,sha256=
|
98
|
+
sticker_convert/utils/auth/telegram_api.py,sha256=hX9fT0Pp8yMxcKSXLe9Mvy12mQ_rWj-KTyamABI8YWA,24232
|
99
99
|
sticker_convert/utils/auth/telethon_setup.py,sha256=QW0RAP3KwnxK9ZHmCo_iGqc1NiskOzsGa1kcmPT9PsQ,2972
|
100
100
|
sticker_convert/utils/files/cache_store.py,sha256=etfe614OAhAyrnM5fGeESKq6R88YLNqkqkxSzEmZ0V0,1047
|
101
101
|
sticker_convert/utils/files/json_manager.py,sha256=Vr6pZJdLMkrJJWN99210aduVHb0ILyf0SSTaw4TZqgc,541
|
@@ -107,9 +107,9 @@ sticker_convert/utils/media/apple_png_normalize.py,sha256=LbrQhc7LlYX4I9ek4XJsZE
|
|
107
107
|
sticker_convert/utils/media/codec_info.py,sha256=_F_iV3k2GYtb8vYZUSKrWl9E7XEW6LDywbnJ-DM6kbk,16476
|
108
108
|
sticker_convert/utils/media/decrypt_kakao.py,sha256=4wq9ZDRnFkx1WmFZnyEogBofiLGsWQM_X69HlA36578,1947
|
109
109
|
sticker_convert/utils/media/format_verify.py,sha256=oM32P186tWe9YxvBQRPr8D3FEmBN3b2rEe_2S_MwxyQ,6236
|
110
|
-
sticker_convert-2.12.
|
111
|
-
sticker_convert-2.12.
|
112
|
-
sticker_convert-2.12.
|
113
|
-
sticker_convert-2.12.
|
114
|
-
sticker_convert-2.12.
|
115
|
-
sticker_convert-2.12.
|
110
|
+
sticker_convert-2.12.4.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
111
|
+
sticker_convert-2.12.4.dist-info/METADATA,sha256=2Z9TXBiRE_dhOaRYaiIKZ_fYnnKOvfuKZH484Rgc_J8,53517
|
112
|
+
sticker_convert-2.12.4.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
113
|
+
sticker_convert-2.12.4.dist-info/entry_points.txt,sha256=MNJ7XyC--ugxi5jS1nzjDLGnxCyLuaGdsVLnJhDHCqs,66
|
114
|
+
sticker_convert-2.12.4.dist-info/top_level.txt,sha256=r9vfnB0l1ZnH5pTH5RvkobnK3Ow9m0RsncaOMAtiAtk,16
|
115
|
+
sticker_convert-2.12.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|