Initial commit: Add webtoon downloader
This commit is contained in:
0
data/__init__.py
Normal file
0
data/__init__.py
Normal file
BIN
data/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
data/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
data/__pycache__/folder.cpython-312.pyc
Normal file
BIN
data/__pycache__/folder.cpython-312.pyc
Normal file
Binary file not shown.
BIN
data/__pycache__/headers_kakao.cpython-312.pyc
Normal file
BIN
data/__pycache__/headers_kakao.cpython-312.pyc
Normal file
Binary file not shown.
BIN
data/__pycache__/kakao_cookie.cpython-312.pyc
Normal file
BIN
data/__pycache__/kakao_cookie.cpython-312.pyc
Normal file
Binary file not shown.
BIN
data/__pycache__/kakao_request.cpython-312.pyc
Normal file
BIN
data/__pycache__/kakao_request.cpython-312.pyc
Normal file
Binary file not shown.
BIN
data/__pycache__/not_processed.cpython-312.pyc
Normal file
BIN
data/__pycache__/not_processed.cpython-312.pyc
Normal file
Binary file not shown.
BIN
data/__pycache__/path_constant.cpython-312.pyc
Normal file
BIN
data/__pycache__/path_constant.cpython-312.pyc
Normal file
Binary file not shown.
BIN
data/__pycache__/special_list.cpython-312.pyc
Normal file
BIN
data/__pycache__/special_list.cpython-312.pyc
Normal file
Binary file not shown.
BIN
data/__pycache__/webtoon_request.cpython-312.pyc
Normal file
BIN
data/__pycache__/webtoon_request.cpython-312.pyc
Normal file
Binary file not shown.
25
data/kakao_cookie.py
Normal file
25
data/kakao_cookie.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
CLIENT_ID = 2155768539
|
||||
|
||||
@dataclass
|
||||
class Cookie:
|
||||
name: str
|
||||
userID: str
|
||||
ant: str
|
||||
|
||||
COOKIES = [
|
||||
Cookie(name="ithi", userID="twnu7577d258564215", ant="MFivJ2uk0eyBd7G28D0_4WSk3QXdpHXxp1rkDaNXdCU~"),#ok
|
||||
Cookie(name="ym", userID="twnu18c780bce30104", ant=""),
|
||||
Cookie(name="83", userID="twnud41942de09830d", ant=""),
|
||||
Cookie(name="bjl", userID="twnuf8429dee79c3d3", ant=""), #ok
|
||||
Cookie(name="yy", userID="twnucbb3bdfce95b85", ant=""),
|
||||
Cookie(name="hk", userID="twnuf622dd45e496ea", ant="ypc2JaDoKwfgghdheiFRCJvBjWid78M9djJooqOeMnY~"),
|
||||
Cookie(name="aa", userID="twnuc0728a46c25738", ant=""), #ok
|
||||
Cookie(name="bb", userID="twnu407ef7f1a046fd", ant="pSQPuFHTEVSztUuDcP4eboMqyY5La0Hb5JRWYILj1z8~"),
|
||||
Cookie(name="wn", userID="twnu7322f207fb75ab", ant="4q3ArCVX_yx5fTq0kWWCanc60SXEnUU3QyuF0wys8Hc~")
|
||||
]
|
||||
|
||||
COOKIE_NAME = 'ithi'
|
||||
URL_TYPE = '1' # 1, 3, 7, m, p
|
||||
TASK_TYPE = 'dc' # d, c
|
||||
42
data/kakao_request.py
Normal file
42
data/kakao_request.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from data.kakao_cookie import CLIENT_ID
|
||||
|
||||
class KakaoRequest:
|
||||
def __init__(self, timestamp, nonce):
|
||||
self.client_id = CLIENT_ID
|
||||
self.timestamp = timestamp
|
||||
self.nonce = nonce
|
||||
self.app_id = f"KP.{self.client_id}.{self.timestamp + 1}"
|
||||
|
||||
def get_episode_headers(self, ant):
|
||||
return {
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "zht",
|
||||
"Cache-Control": "no-cache",
|
||||
"Cookie": f"theme=dark; _kp_collector={self.app_id}; atn={ant}",
|
||||
"Dnt": "1",
|
||||
"Origin": "https://tw.kakaowebtoon.com",
|
||||
"Pragma": "no-cache",
|
||||
"Referer": "https://tw.kakaowebtoon.com/",
|
||||
"Sec-Ch-Ua": '"Not A(Brand";v="99", "Microsoft Edge";v="121", "Chromium";v="121"',
|
||||
"Sec-Ch-Ua-Mobile": "?0",
|
||||
"Sec-Ch-Ua-Platform": '"Windows"',
|
||||
"Sec-Fetch-Dest": "empty",
|
||||
"Sec-Fetch-Mode": "cors",
|
||||
"Sec-Fetch-Site": "same-site",
|
||||
"Sec-Gpc": "1",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
|
||||
}
|
||||
|
||||
def get_post_headers(self, ant):
|
||||
return self.get_episode_headers(ant) | {"Content-Type": "application/json;charset=UTF-8"}
|
||||
|
||||
def get_payload(self, episode_id):
|
||||
return {
|
||||
"id": episode_id,
|
||||
"type": "AES_CBC_WEBP",
|
||||
"nonce": self.nonce,
|
||||
"timestamp": str(self.timestamp),
|
||||
"download": False,
|
||||
"webAppId": self.app_id,
|
||||
}
|
||||
11
data/path_constant.py
Normal file
11
data/path_constant.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
DOWNLOAD_DIR = Path('E:/') / 'Webtoon'
|
||||
NETWORK_DIR = Path('//TRUENAS') / 'Media' / 'Webtoon'
|
||||
TEMP_DOWNLOAD_DIR = Path('E:/') / 'Temp_Webtoon'
|
||||
|
||||
DOWNLOAD_LIST_TXT = Path(DOWNLOAD_DIR) / 'download.txt'
|
||||
TEMP_DOWNLOAD_LIST_TXT = Path(TEMP_DOWNLOAD_DIR) / 'download_kakao.txt'
|
||||
|
||||
ANDROID_ASSETS = Path('E:/') / 'Projects' / 'AndroidStudioProjects' / 'WebtoonViewer' / 'app' / 'src' / 'main' / 'assets'
|
||||
62
data/special_list.py
Normal file
62
data/special_list.py
Normal file
@@ -0,0 +1,62 @@
|
||||
WEBTOON_NOT_PROCESSED = [
|
||||
'陷阱', # 完结
|
||||
'8級魔法師再臨', # 完结
|
||||
'婚姻這門生意[18+]', # 完结
|
||||
'守護女主角哥哥的方法', # KakaoTW完结
|
||||
'轉生後變成天才', # KakaoTW完结
|
||||
'兩個繼承人', # KakaoTW完结
|
||||
'患上不出道就會死的病', # KakaoTW完结
|
||||
'無法品味的男人', # KakaoTW完结
|
||||
'摘下偽善男主角的面具', # KakaoTW完结
|
||||
'皇家婚姻', # KakaoTW完结
|
||||
'鐵血家族獵犬的重生', # KakaoTW完结
|
||||
'重生百次的最強玩家', # KakaoTW完结
|
||||
'我獨自升級', # KakaoTW完结
|
||||
'結局創造者', # 停更
|
||||
'黑影之夜', # 季休
|
||||
'狂魔重生記', # 季休
|
||||
'在魔法學院偽裝教師', # 季休
|
||||
'兔子與黑豹的共生關係', # 付费 / 季休
|
||||
'成為家人的方法', # YDS下载后续
|
||||
]
|
||||
|
||||
WEBTOON_18_BONUS = [
|
||||
'婚姻這門生意[18+]'
|
||||
]
|
||||
|
||||
KAKAO_ONLY_MAIN_ACCOUNT = [
|
||||
'152', # 骷髏士兵卷土重來
|
||||
'167', # 試著改變故事類型吧 P
|
||||
'222', # 成為我筆下男主角的妻子
|
||||
'247', # 領主夫人罷工中
|
||||
'322', # 婚姻這門生意 P
|
||||
'330', # 同情的形態 P
|
||||
'399', # 噬魔法師
|
||||
'424', # 地下城見聞錄
|
||||
'587', # Pickmeup
|
||||
'591', # 武當奇俠
|
||||
'736', # Boss大人請振作
|
||||
'784', # 永遠的謊言
|
||||
'787', # 魔法師的校園生存法則
|
||||
'862', # 符文之子
|
||||
]
|
||||
|
||||
KAKAO_1 = [
|
||||
'41'
|
||||
]
|
||||
|
||||
KAKAO_3 = [
|
||||
'303', # 天才詐欺犯的雙重身分
|
||||
]
|
||||
|
||||
KAKAO_7 = [
|
||||
'41', # 反派角色只有死亡結局
|
||||
'116', # 惡女重生
|
||||
'200', # 暴君就該配惡女
|
||||
'233', # 少女賭神愛黛兒
|
||||
]
|
||||
|
||||
KAKAO_PAY = [
|
||||
'230', # 兔子與黑豹的共生關係
|
||||
'516', # 結局創造者
|
||||
]
|
||||
39
data/webtoon_request.py
Normal file
39
data/webtoon_request.py
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
def get_webtoon_headers():
|
||||
return {
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7",
|
||||
"Referer": "http://www.webtoons.com",
|
||||
"Sec-Ch-Ua": '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
|
||||
"Sec-Ch-Ua-Arch": '"x86"',
|
||||
"Sec-Ch-Ua-Bitness": '"64"',
|
||||
"Sec-Ch-Ua-Full-Version-List": '"Not_A Brand";v="8.0.0.0", "Chromium";v="120.0.6099.130", "Google Chrome";v="120.0.6099.130"',
|
||||
"Sec-Ch-Ua-Mobile": "?0",
|
||||
"Sec-Ch-Ua-Model": '""',
|
||||
"Sec-Ch-Ua-Platform": '"Windows"',
|
||||
"Sec-Ch-Ua-Platform-Version": '"15.0.0"',
|
||||
"Sec-Ch-Ua-Wow64": "?0",
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
||||
}
|
||||
|
||||
def get_bomtoon_headers():
|
||||
return {
|
||||
"Accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
|
||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
||||
"Accept-Language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,zh-CN;q=0.6,zh;q=0.5",
|
||||
"Priority": "i",
|
||||
"Referer": "https://www.bomtoon.tw/",
|
||||
"Sec-Ch-Ua": '"Not_A Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
|
||||
"Sec-Ch-Ua-Mobile": "?0",
|
||||
"Sec-Ch-Ua-Platform": '"Windows"',
|
||||
"Sec-Fetch-Dest": "image",
|
||||
"Sec-Fetch-Mode": "no-cors",
|
||||
"Sec-Fetch-Site": "cross-site",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
||||
}
|
||||
Reference in New Issue
Block a user