sticker-convert 2.13.3.0__py3-none-any.whl → 2.17.0.0__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/__main__.py +24 -27
- sticker_convert/auth/__init__.py +0 -0
- sticker_convert/auth/auth_base.py +19 -0
- sticker_convert/{utils/auth/get_discord_auth.py → auth/auth_discord.py} +149 -118
- sticker_convert/{utils/auth/get_kakao_auth.py → auth/auth_kakao_android_login.py} +331 -330
- sticker_convert/auth/auth_kakao_desktop_login.py +327 -0
- sticker_convert/{utils/auth/get_kakao_desktop_auth.py → auth/auth_kakao_desktop_memdump.py} +281 -263
- sticker_convert/{utils/auth/get_line_auth.py → auth/auth_line.py} +98 -80
- sticker_convert/{utils/auth/get_signal_auth.py → auth/auth_signal.py} +139 -135
- sticker_convert/auth/auth_telethon.py +161 -0
- sticker_convert/{utils/auth/get_viber_auth.py → auth/auth_viber.py} +250 -235
- sticker_convert/{utils/auth → auth}/telegram_api.py +736 -675
- sticker_convert/cli.py +623 -608
- sticker_convert/converter.py +1093 -1084
- sticker_convert/definitions.py +4 -0
- sticker_convert/downloaders/download_band.py +111 -110
- sticker_convert/downloaders/download_base.py +171 -166
- sticker_convert/downloaders/download_discord.py +92 -91
- sticker_convert/downloaders/download_kakao.py +417 -404
- sticker_convert/downloaders/download_line.py +484 -475
- sticker_convert/downloaders/download_ogq.py +80 -79
- sticker_convert/downloaders/download_signal.py +108 -105
- sticker_convert/downloaders/download_telegram.py +56 -55
- sticker_convert/downloaders/download_viber.py +121 -120
- sticker_convert/gui.py +788 -873
- sticker_convert/gui_components/frames/comp_frame.py +180 -166
- sticker_convert/gui_components/frames/config_frame.py +156 -113
- sticker_convert/gui_components/frames/control_frame.py +32 -30
- sticker_convert/gui_components/frames/cred_frame.py +232 -233
- sticker_convert/gui_components/frames/input_frame.py +139 -137
- sticker_convert/gui_components/frames/output_frame.py +112 -110
- sticker_convert/gui_components/frames/right_clicker.py +25 -23
- sticker_convert/gui_components/windows/advanced_compression_window.py +757 -757
- sticker_convert/gui_components/windows/base_window.py +7 -2
- sticker_convert/gui_components/windows/discord_get_auth_window.py +79 -82
- sticker_convert/gui_components/windows/kakao_get_auth_window.py +511 -321
- sticker_convert/gui_components/windows/line_get_auth_window.py +94 -102
- sticker_convert/gui_components/windows/signal_get_auth_window.py +84 -89
- sticker_convert/gui_components/windows/viber_get_auth_window.py +168 -168
- sticker_convert/ios-message-stickers-template/.github/FUNDING.yml +3 -3
- sticker_convert/ios-message-stickers-template/README.md +10 -10
- sticker_convert/ios-message-stickers-template/stickers/Info.plist +43 -43
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Info.plist +31 -31
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Contents.json +6 -6
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Contents.json +20 -20
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json +91 -91
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.pbxproj +364 -364
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -7
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/xcuserdata/niklaspeterson.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- sticker_convert/job.py +166 -130
- sticker_convert/job_option.py +1 -0
- sticker_convert/locales/en_US/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/ja_JP/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/zh_CN/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/zh_TW/LC_MESSAGES/base.mo +0 -0
- sticker_convert/py.typed +0 -0
- sticker_convert/resources/NotoColorEmoji.ttf +0 -0
- sticker_convert/resources/help.ja_JP.json +88 -0
- sticker_convert/resources/help.json +10 -7
- sticker_convert/resources/help.zh_CN.json +88 -0
- sticker_convert/resources/help.zh_TW.json +88 -0
- sticker_convert/resources/input.ja_JP.json +74 -0
- sticker_convert/resources/input.json +121 -121
- sticker_convert/resources/input.zh_CN.json +74 -0
- sticker_convert/resources/input.zh_TW.json +74 -0
- sticker_convert/resources/output.ja_JP.json +38 -0
- sticker_convert/resources/output.zh_CN.json +38 -0
- sticker_convert/resources/output.zh_TW.json +38 -0
- sticker_convert/uploaders/compress_wastickers.py +186 -177
- sticker_convert/uploaders/upload_base.py +44 -35
- sticker_convert/uploaders/upload_signal.py +218 -203
- sticker_convert/uploaders/upload_telegram.py +353 -338
- sticker_convert/uploaders/upload_viber.py +178 -169
- sticker_convert/uploaders/xcode_imessage.py +295 -286
- sticker_convert/utils/callback.py +238 -6
- sticker_convert/utils/emoji.py +16 -4
- sticker_convert/utils/files/json_resources_loader.py +24 -19
- sticker_convert/utils/files/metadata_handler.py +3 -3
- sticker_convert/utils/translate.py +108 -0
- sticker_convert/utils/url_detect.py +40 -37
- sticker_convert/version.py +1 -1
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/METADATA +89 -74
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/RECORD +91 -74
- sticker_convert/utils/auth/telethon_setup.py +0 -97
- sticker_convert/utils/singletons.py +0 -18
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/WHEEL +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/entry_points.txt +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/licenses/LICENSE +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,91 +1,92 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
import json
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Dict, List, Optional, Tuple, cast
|
|
5
|
-
from urllib.parse import urlparse
|
|
6
|
-
|
|
7
|
-
import requests
|
|
8
|
-
|
|
9
|
-
from sticker_convert.downloaders.download_base import DownloadBase
|
|
10
|
-
from sticker_convert.job_option import CredOption, InputOption
|
|
11
|
-
from sticker_convert.utils.callback import CallbackProtocol, CallbackReturn
|
|
12
|
-
from sticker_convert.utils.emoji import extract_emojis
|
|
13
|
-
from sticker_convert.utils.files.metadata_handler import MetadataHandler
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
#
|
|
17
|
-
# https://github.com/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import json
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Dict, List, Optional, Tuple, cast
|
|
5
|
+
from urllib.parse import urlparse
|
|
6
|
+
|
|
7
|
+
import requests
|
|
8
|
+
|
|
9
|
+
from sticker_convert.downloaders.download_base import DownloadBase
|
|
10
|
+
from sticker_convert.job_option import CredOption, InputOption
|
|
11
|
+
from sticker_convert.utils.callback import CallbackProtocol, CallbackReturn
|
|
12
|
+
from sticker_convert.utils.emoji import extract_emojis
|
|
13
|
+
from sticker_convert.utils.files.metadata_handler import MetadataHandler
|
|
14
|
+
from sticker_convert.utils.translate import I
|
|
15
|
+
|
|
16
|
+
# References:
|
|
17
|
+
# https://github.com/ThaTiemsz/Discord-Emoji-Downloader/blob/master/assets/app.js
|
|
18
|
+
# https://github.com/zgibberish/discord-emoji-scraper/blob/main/emoji_scraper.py
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DownloadDiscord(DownloadBase):
|
|
22
|
+
# def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
23
|
+
# super().__init__(*args, **kwargs)
|
|
24
|
+
|
|
25
|
+
def download_stickers_discord(self) -> Tuple[int, int]:
|
|
26
|
+
if self.opt_cred is None or self.opt_cred.discord_token == "":
|
|
27
|
+
self.cb.put(I("Error: Downloading from Discord requires token"))
|
|
28
|
+
return 0, 0
|
|
29
|
+
|
|
30
|
+
gid: Optional[str] = None
|
|
31
|
+
if self.url.isnumeric():
|
|
32
|
+
gid = self.url
|
|
33
|
+
else:
|
|
34
|
+
url_parsed = urlparse(self.url)
|
|
35
|
+
if url_parsed.netloc == "discord.com":
|
|
36
|
+
gid = url_parsed.path.split("/")[2]
|
|
37
|
+
|
|
38
|
+
if gid is None or gid.isnumeric() is False:
|
|
39
|
+
self.cb.put(I("Error: Invalid url"))
|
|
40
|
+
return 0, 0
|
|
41
|
+
|
|
42
|
+
headers = {
|
|
43
|
+
"Authorization": self.opt_cred.discord_token,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
r = requests.get(f"https://discord.com/api/v10/guilds/{gid}", headers=headers)
|
|
47
|
+
r_json = json.loads(r.text)
|
|
48
|
+
|
|
49
|
+
if self.input_option == "discord_emoji":
|
|
50
|
+
stickers = r_json["emojis"]
|
|
51
|
+
else:
|
|
52
|
+
stickers = r_json["stickers"]
|
|
53
|
+
|
|
54
|
+
targets: List[Tuple[str, Path]] = []
|
|
55
|
+
emoji_dict: Dict[str, str] = {}
|
|
56
|
+
for i, sticker in enumerate(stickers):
|
|
57
|
+
f_id = str(i).zfill(3)
|
|
58
|
+
sticker_id = sticker["id"]
|
|
59
|
+
if self.input_option == "discord_emoji":
|
|
60
|
+
f_ext = ".gif" if sticker["animated"] else ".png"
|
|
61
|
+
sticker_url = f"https://cdn.discordapp.com/emojis/{sticker_id}{f_ext}?size=4096&quality=lossless"
|
|
62
|
+
else:
|
|
63
|
+
# https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-format-types
|
|
64
|
+
format_type = cast(int, sticker["format_type"])
|
|
65
|
+
f_ext = [".png", ".png", ".json", ".gif"][format_type - 1]
|
|
66
|
+
sticker_url = f"https://cdn.discordapp.com/stickers/{sticker_id}{f_ext}?size=4096&quality=lossless"
|
|
67
|
+
emoji_dict[f_id] = extract_emojis(sticker["tags"])
|
|
68
|
+
f_name = f_id + f_ext
|
|
69
|
+
f_path = Path(self.out_dir, f_name)
|
|
70
|
+
targets.append((sticker_url, f_path))
|
|
71
|
+
|
|
72
|
+
results = self.download_multiple_files(targets)
|
|
73
|
+
|
|
74
|
+
server_name = r_json["name"]
|
|
75
|
+
MetadataHandler.set_metadata(
|
|
76
|
+
self.out_dir,
|
|
77
|
+
title=server_name,
|
|
78
|
+
author=server_name,
|
|
79
|
+
emoji_dict=emoji_dict if self.input_option == "discord" else None,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
return sum(results.values()), len(targets)
|
|
83
|
+
|
|
84
|
+
@staticmethod
|
|
85
|
+
def start(
|
|
86
|
+
opt_input: InputOption,
|
|
87
|
+
opt_cred: Optional[CredOption],
|
|
88
|
+
cb: CallbackProtocol,
|
|
89
|
+
cb_return: CallbackReturn,
|
|
90
|
+
) -> Tuple[int, int]:
|
|
91
|
+
downloader = DownloadDiscord(opt_input, opt_cred, cb, cb_return)
|
|
92
|
+
return downloader.download_stickers_discord()
|