Created
December 28, 2025 01:45
-
-
Save zhangyingda/1d5d77f00b79d4ef2b01b74bb59b2667 to your computer and use it in GitHub Desktop.
中华珍宝馆 g2.ltfc.net
This file contains hidden or 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
| """ | |
| tip: execjs => pip install PyExecJs | |
| PIL => pip install pillow | |
| support | |
| 第一代:(不再支持) | |
| http://www.ltfc.net/img/60213b46a7e642759889243b | |
| https://cag.ltfc.net/cagstore/60213b46a7e642759889243b/16/0_1.jpg?&sign=40099f3ab7bd64f681cd87ef0dc860ca&t=639fa980 | |
| 第二代: | |
| http://g2.ltfc.net/view/SUHA/60d5bb8e6155e14a09d1665a | |
| http://g2.ltfc.net/view/SHIY/60bb5857611ecdd2f4023c07 | |
| updated 2022-04-02 | |
| by Polygon | |
| """ | |
| from threading import Thread | |
| from queue import Queue | |
| from PIL import Image | |
| import requests | |
| import execjs | |
| import time | |
| import math | |
| import re | |
| import os | |
| from PIL import ImageFile | |
| ImageFile.LOAD_TRUNCATED_IMAGES = True | |
| from urllib.request import getproxies | |
| proxies = getproxies() | |
| if proxies: | |
| os.environ['HTTP_PROXY'] = proxies['http'] | |
| os.environ['HTTPS_PROXY'] = proxies['http'] | |
| class ParsePNG: | |
| """ | |
| mode: 输出格式 | |
| quality: 18 原画,每减 1,画质损失一半 | |
| threadCount: 下载拼图线程数,值越大越快 | |
| tileSize: 不要修改 | |
| """ | |
| mode = 'png' | |
| quality = 18 | |
| threadCount = 16 | |
| tileSize = 512 | |
| finish = 0 | |
| def __init__(self, kwargs): | |
| """ | |
| kwargs: | |
| title | |
| uuid | |
| totalWidth | |
| totalHeight | |
| """ | |
| # 更新参数 | |
| for k, v in kwargs.items(): | |
| self.__dict__[k] = v | |
| self.totalWidth = int(self.totalWidth / 2**(18 - self.quality)) | |
| self.totalHeight = int(self.totalHeight / 2**(18 - self.quality)) | |
| if min(self.totalHeight, self.totalWidth) < self.tileSize: raise ValueError(f'{self.quality} value of a is too small') | |
| print(f'title={self.title} | totalWidth={self.totalWidth} | totalHeight={self.totalHeight}') | |
| # 创建文件夹 | |
| self.root = os.path.join(self.root, self.title) | |
| print(self.root) | |
| if not os.path.exists(self.root): os.makedirs(self.root) | |
| # 下载 | |
| self.urlQueue = Queue() | |
| self.fileQueue = Queue() | |
| self.downloadImages() | |
| # 显示进度条 | |
| def printState(self): | |
| self.isFinished = False | |
| self.downloading = '' | |
| self.merging = '' | |
| while not self.isFinished: | |
| if self.downloading and self.merging: | |
| self.downloading.split('.')[0].split('_') | |
| percent = self.finish / self.total * 100 | |
| if self.finish == self.total: | |
| self.fileQueue.put(False) | |
| print(f'\r{percent:.2f}% | downloading {self.downloading} | merging {self.merging}' + ' ' * 20, end='') | |
| def encodeImageURL(self, baseURL): | |
| t = hex(int(int(math.ceil(time.time()*1000 / 31536e6)*31536e3 )))[2:] | |
| reg = r"^(http.*\/\/[^\/]*)(\/.*\.(jpg|jpeg))\?*(.*)$" | |
| res = re.match(reg, baseURL) | |
| host, path, param = res.group(1), res.group(2), res.group(4) | |
| baseURL = self.cag_host + path + t | |
| # 这里用到了 md5 算法,直接复制 js 中的代码,用 execjs 来执行 | |
| imageURL = ''.join([host, path, "?", param, "&sign=", self.cag(baseURL), "&t=", t]) | |
| return imageURL | |
| def save(self): | |
| base = 'https://cag.ltfc.net/cagstore/' + self.uuid + '/' + str(self.quality) + '/{}_{}.jpg' | |
| while not self.urlQueue.empty(): | |
| column, row = self.urlQueue.get() | |
| baseURL = base.format(column, row) | |
| imageURL = self.encodeImageURL(baseURL) | |
| filename = re.findall(r'/(\d+_\d+\.(jpg|jpeg))\?', imageURL)[0][0] | |
| self.downloading = filename | |
| try: | |
| res = requests.get(imageURL) | |
| if res.headers['Content-Type'] in ['application/json', 'text/html']: | |
| print('requests imageURL fail') | |
| continue | |
| with open(os.path.join(self.root, filename), 'wb') as f: | |
| f.write(res.content) | |
| self.fileQueue.put(filename) | |
| except: | |
| self.urlQueue.put((column, row)) | |
| def downloadImages(self): | |
| headers={ | |
| 'Host': 'api.quanku.art', | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0', | |
| 'Accept': 'application/json, text/plain, */*', | |
| 'Accept-Language': 'en-US,en;q=0.5', | |
| 'Accept-Encoding': 'gzip, deflate, br', | |
| 'Content-Type': 'application/json', | |
| 'Origin': 'https://g2.ltfc.net', | |
| 'Connection': 'keep-alive', | |
| 'Sec-Fetch-Dest': 'empty', | |
| 'Sec-Fetch-Mode': 'no-cors', | |
| 'Sec-Fetch-Site': 'cross-site', | |
| 'Referer': 'https://g2.ltfc.net/', | |
| 'Pragma': 'no-cache', | |
| 'Cache-Control': 'no-cache' | |
| } | |
| columnCount, rowCount = math.ceil(self.totalWidth / self.tileSize), math.ceil(self.totalHeight / self.tileSize) | |
| self.total = columnCount * rowCount | |
| Thread(target=self.mergeImages).start() | |
| Thread(target=self.printState).start() | |
| self.cag_host="b49b4d8a45b8f098ba881d98abbb5c892f8b5c98" | |
| print("columnCount",columnCount,"rowCount",rowCount) | |
| for column in range(columnCount): | |
| for row in range(rowCount): | |
| self.urlQueue.put((column, row)) | |
| for _ in range(self.threadCount): | |
| Thread(target=self.save).start() | |
| def mergeImages(self): | |
| to_image = Image.new('RGB', (self.totalWidth, self.totalHeight)) | |
| while True: | |
| file = self.fileQueue.get() | |
| if not file: break | |
| self.merging = file | |
| column, row = list(map(int, file.split('.')[0].split('_'))) | |
| filepath = os.path.join(self.root, file) | |
| from_image = Image.open(filepath) | |
| to_image.paste(from_image, (column * self.tileSize, row * self.tileSize)) | |
| # 删除临时文件 | |
| os.remove(filepath) | |
| self.finish += 1 | |
| self.isFinished = True | |
| print('\nwrite to local...') | |
| filepath = os.path.join(self.root, f'{self.title}.{self.mode}') | |
| to_image.save(filepath) | |
| print(f'success | {filepath}') | |
| # 打开文件 | |
| os.startfile(filepath) | |
| @staticmethod | |
| def cag(s): | |
| jsStr = """ | |
| function cagcycle(t, e) { | |
| var n = ff(n = t[0], s = t[1], r = t[2], i = t[3], e[0], 7, -680876936) | |
| , i = ff(i, n, s, r, e[1], 12, -389564586) | |
| , r = ff(r, i, n, s, e[2], 17, 606105819) | |
| , s = ff(s, r, i, n, e[3], 22, -1044525330); | |
| n = ff(n, s, r, i, e[4], 7, -176418897), | |
| i = ff(i, n, s, r, e[5], 12, 1200080426), | |
| r = ff(r, i, n, s, e[6], 17, -1473231341), | |
| s = ff(s, r, i, n, e[7], 22, -45705983), | |
| n = ff(n, s, r, i, e[8], 7, 1770035416), | |
| i = ff(i, n, s, r, e[9], 12, -1958414417), | |
| r = ff(r, i, n, s, e[10], 17, -42063), | |
| s = ff(s, r, i, n, e[11], 22, -1990404162), | |
| n = ff(n, s, r, i, e[12], 7, 1804603682), | |
| i = ff(i, n, s, r, e[13], 12, -40341101), | |
| r = ff(r, i, n, s, e[14], 17, -1502002290), | |
| n = gg(n, s = ff(s, r, i, n, e[15], 22, 1236535329), r, i, e[1], 5, -165796510), | |
| i = gg(i, n, s, r, e[6], 9, -1069501632), | |
| r = gg(r, i, n, s, e[11], 14, 643717713), | |
| s = gg(s, r, i, n, e[0], 20, -373897302), | |
| n = gg(n, s, r, i, e[5], 5, -701558691), | |
| i = gg(i, n, s, r, e[10], 9, 38016083), | |
| r = gg(r, i, n, s, e[15], 14, -660478335), | |
| s = gg(s, r, i, n, e[4], 20, -405537848), | |
| n = gg(n, s, r, i, e[9], 5, 568446438), | |
| i = gg(i, n, s, r, e[14], 9, -1019803690), | |
| r = gg(r, i, n, s, e[3], 14, -187363961), | |
| s = gg(s, r, i, n, e[8], 20, 1163531501), | |
| n = gg(n, s, r, i, e[13], 5, -1444681467), | |
| i = gg(i, n, s, r, e[2], 9, -51403784), | |
| r = gg(r, i, n, s, e[7], 14, 1735328473), | |
| n = hh(n, s = gg(s, r, i, n, e[12], 20, -1926607734), r, i, e[5], 4, -378558), | |
| i = hh(i, n, s, r, e[8], 11, -2022574463), | |
| r = hh(r, i, n, s, e[11], 16, 1839030562), | |
| s = hh(s, r, i, n, e[14], 23, -35309556), | |
| n = hh(n, s, r, i, e[1], 4, -1530992060), | |
| i = hh(i, n, s, r, e[4], 11, 1272893353), | |
| r = hh(r, i, n, s, e[7], 16, -155497632), | |
| s = hh(s, r, i, n, e[10], 23, -1094730640), | |
| n = hh(n, s, r, i, e[13], 4, 681279174), | |
| i = hh(i, n, s, r, e[0], 11, -358537222), | |
| r = hh(r, i, n, s, e[3], 16, -722521979), | |
| s = hh(s, r, i, n, e[6], 23, 76029189), | |
| n = hh(n, s, r, i, e[9], 4, -640364487), | |
| i = hh(i, n, s, r, e[12], 11, -421815835), | |
| r = hh(r, i, n, s, e[15], 16, 530742520), | |
| n = ii(n, s = hh(s, r, i, n, e[2], 23, -995338651), r, i, e[0], 6, -198630844), | |
| i = ii(i, n, s, r, e[7], 10, 1126891415), | |
| r = ii(r, i, n, s, e[14], 15, -1416354905), | |
| s = ii(s, r, i, n, e[5], 21, -57434055), | |
| n = ii(n, s, r, i, e[12], 6, 1700485571), | |
| i = ii(i, n, s, r, e[3], 10, -1894986606), | |
| r = ii(r, i, n, s, e[10], 15, -1051523), | |
| s = ii(s, r, i, n, e[1], 21, -2054922799), | |
| n = ii(n, s, r, i, e[8], 6, 1873313359), | |
| i = ii(i, n, s, r, e[15], 10, -30611744), | |
| r = ii(r, i, n, s, e[6], 15, -1560198380), | |
| s = ii(s, r, i, n, e[13], 21, 1309151649), | |
| n = ii(n, s, r, i, e[4], 6, -145523070), | |
| i = ii(i, n, s, r, e[11], 10, -1120210379), | |
| r = ii(r, i, n, s, e[2], 15, 718787259), | |
| s = ii(s, r, i, n, e[9], 21, -343485551), | |
| t[0] = add32(n, t[0]), | |
| t[1] = add32(s, t[1]), | |
| t[2] = add32(r, t[2]), | |
| t[3] = add32(i, t[3]) | |
| } | |
| function cmn(t, e, n, i, r, s) { | |
| return e = add32(add32(e, t), add32(i, s)), | |
| add32(e << r | e >>> 32 - r, n) | |
| } | |
| function ff(t, e, n, i, r, s, o) { | |
| return cmn(e & n | ~e & i, t, e, r, s, o) | |
| } | |
| function gg(t, e, n, i, r, s, o) { | |
| return cmn(e & i | n & ~i, t, e, r, s, o) | |
| } | |
| function hh(t, e, n, i, r, s, o) { | |
| return cmn(e ^ n ^ i, t, e, r, s, o) | |
| } | |
| function ii(t, e, n, i, r, s, o) { | |
| return cmn(n ^ (e | ~i), t, e, r, s, o) | |
| } | |
| function cag1(t) { | |
| txt = ""; | |
| for (var e = t.length, n = [1732584193, -271733879, -1732584194, 271733878], i = 64; i <= t.length; i += 64) | |
| cagcycle(n, cagblk(t.substring(i - 64, i))); | |
| t = t.substring(i - 64); | |
| var r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | |
| for (i = 0; i < t.length; i++) | |
| r[i >> 2] |= t.charCodeAt(i) << (i % 4 << 3); | |
| if (r[i >> 2] |= 128 << (i % 4 << 3), | |
| 55 < i) | |
| for (cagcycle(n, r), | |
| i = 0; i < 16; i++) | |
| r[i] = 0; | |
| return r[14] = 8 * e, | |
| cagcycle(n, r), | |
| n | |
| } | |
| function cagblk(t) { | |
| for (var e = [], n = 0; n < 64; n += 4) | |
| e[n >> 2] = t.charCodeAt(n) + (t.charCodeAt(n + 1) << 8) + (t.charCodeAt(n + 2) << 16) + (t.charCodeAt(n + 3) << 24); | |
| return e | |
| } | |
| var hex_chr = "0123456789abcdef".split(""); | |
| function rhex(t) { | |
| for (var e = "", n = 0; n < 4; n++) | |
| e += hex_chr[t >> 8 * n + 4 & 15] + hex_chr[t >> 8 * n & 15]; | |
| return e | |
| } | |
| function hex(t) { | |
| for (var e = 0; e < t.length; e++) | |
| t[e] = rhex(t[e]); | |
| return t.join("") | |
| } | |
| function cag(t) { | |
| return hex(cag1(t)) | |
| } | |
| function add32(t, e) { | |
| return t + e & 4294967295 | |
| } | |
| { | |
| function add32(t, e) { | |
| var n = (65535 & t) + (65535 & e); | |
| return (t >> 16) + (e >> 16) + (n >> 16) << 16 | 65535 & n | |
| } | |
| cag("hello") | |
| } | |
| """ | |
| js = execjs.compile(jsStr) | |
| return js.call('cag', s) | |
| @staticmethod | |
| def mcag(s): | |
| jsStr=""" | |
| function L(e, t) { | |
| let n = e[0] | |
| , i = e[1] | |
| , o = e[2] | |
| , a = e[3]; | |
| n = h(n, i, o, a, t[0], 7, -680876936), | |
| a = h(a, n, i, o, t[1], 12, -389564586), | |
| o = h(o, a, n, i, t[2], 17, 606105819), | |
| i = h(i, o, a, n, t[3], 22, -1044525330), | |
| n = h(n, i, o, a, t[4], 7, -176418897), | |
| a = h(a, n, i, o, t[5], 12, 1200080426), | |
| o = h(o, a, n, i, t[6], 17, -1473231341), | |
| i = h(i, o, a, n, t[7], 22, -45705983), | |
| n = h(n, i, o, a, t[8], 7, 1770035416), | |
| a = h(a, n, i, o, t[9], 12, -1958414417), | |
| o = h(o, a, n, i, t[10], 17, -42063), | |
| i = h(i, o, a, n, t[11], 22, -1990404162), | |
| n = h(n, i, o, a, t[12], 7, 1804603682), | |
| a = h(a, n, i, o, t[13], 12, -40341101), | |
| o = h(o, a, n, i, t[14], 17, -1502002290), | |
| i = h(i, o, a, n, t[15], 22, 1236535329), | |
| n = g(n, i, o, a, t[1], 5, -165796510), | |
| a = g(a, n, i, o, t[6], 9, -1069501632), | |
| o = g(o, a, n, i, t[11], 14, 643717713), | |
| i = g(i, o, a, n, t[0], 20, -373897302), | |
| n = g(n, i, o, a, t[5], 5, -701558691), | |
| a = g(a, n, i, o, t[10], 9, 38016083), | |
| o = g(o, a, n, i, t[15], 14, -660478335), | |
| i = g(i, o, a, n, t[4], 20, -405537848), | |
| n = g(n, i, o, a, t[9], 5, 568446438), | |
| a = g(a, n, i, o, t[14], 9, -1019803690), | |
| o = g(o, a, n, i, t[3], 14, -187363961), | |
| i = g(i, o, a, n, t[8], 20, 1163531501), | |
| n = g(n, i, o, a, t[13], 5, -1444681467), | |
| a = g(a, n, i, o, t[2], 9, -51403784), | |
| o = g(o, a, n, i, t[7], 14, 1735328473), | |
| i = g(i, o, a, n, t[12], 20, -1926607734), | |
| n = f(n, i, o, a, t[5], 4, -378558), | |
| a = f(a, n, i, o, t[8], 11, -2022574463), | |
| o = f(o, a, n, i, t[11], 16, 1839030562), | |
| i = f(i, o, a, n, t[14], 23, -35309556), | |
| n = f(n, i, o, a, t[1], 4, -1530992060), | |
| a = f(a, n, i, o, t[4], 11, 1272893353), | |
| o = f(o, a, n, i, t[7], 16, -155497632), | |
| i = f(i, o, a, n, t[10], 23, -1094730640), | |
| n = f(n, i, o, a, t[13], 4, 681279174), | |
| a = f(a, n, i, o, t[0], 11, -358537222), | |
| o = f(o, a, n, i, t[3], 16, -722521979), | |
| i = f(i, o, a, n, t[6], 23, 76029189), | |
| n = f(n, i, o, a, t[9], 4, -640364487), | |
| a = f(a, n, i, o, t[12], 11, -421815835), | |
| o = f(o, a, n, i, t[15], 16, 530742520), | |
| i = f(i, o, a, n, t[2], 23, -995338651), | |
| n = m(n, i, o, a, t[0], 6, -198630844), | |
| a = m(a, n, i, o, t[7], 10, 1126891415), | |
| o = m(o, a, n, i, t[14], 15, -1416354905), | |
| i = m(i, o, a, n, t[5], 21, -57434055), | |
| n = m(n, i, o, a, t[12], 6, 1700485571), | |
| a = m(a, n, i, o, t[3], 10, -1894986606), | |
| o = m(o, a, n, i, t[10], 15, -1051523), | |
| i = m(i, o, a, n, t[1], 21, -2054922799), | |
| n = m(n, i, o, a, t[8], 6, 1873313359), | |
| a = m(a, n, i, o, t[15], 10, -30611744), | |
| o = m(o, a, n, i, t[6], 15, -1560198380), | |
| i = m(i, o, a, n, t[13], 21, 1309151649), | |
| n = m(n, i, o, a, t[4], 6, -145523070), | |
| a = m(a, n, i, o, t[11], 10, -1120210379), | |
| o = m(o, a, n, i, t[2], 15, 718787259), | |
| i = m(i, o, a, n, t[9], 21, -343485551), | |
| e[0] = E(n, e[0]), | |
| e[1] = E(i, e[1]), | |
| e[2] = E(o, e[2]), | |
| e[3] = E(a, e[3]) | |
| } | |
| function N(e, t, n, i, o, a) { | |
| return t = E(E(t, e), E(i, a)), | |
| E(t << o | t >>> 32 - o, n) | |
| } | |
| function h(e, t, n, i, o, a, r) { | |
| return N(t & n | ~t & i, e, t, o, a, r) | |
| } | |
| function g(e, t, n, i, o, a, r) { | |
| return N(t & i | n & ~i, e, t, o, a, r) | |
| } | |
| function f(e, t, n, i, o, a, r) { | |
| return N(t ^ n ^ i, e, t, o, a, r) | |
| } | |
| function m(e, t, n, i, o, a, r) { | |
| return N(n ^ (t | ~i), e, t, o, a, r) | |
| } | |
| function pe(e) { | |
| let t = e.length, n = [1732584193, -271733879, -1732584194, 271733878], i; | |
| for (i = 64; i <= e.length; i += 64) | |
| L(n, ve(e.substring(i - 64, i))); | |
| e = e.substring(i - 64); | |
| let o = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | |
| for (i = 0; i < e.length; i++) | |
| o[i >> 2] |= e.charCodeAt(i) << (i % 4 << 3); | |
| if (o[i >> 2] |= 128 << (i % 4 << 3), | |
| i > 55) | |
| for (L(n, o), | |
| i = 0; i < 16; i++) | |
| o[i] = 0; | |
| return o[14] = t * 8, | |
| L(n, o), | |
| n | |
| } | |
| function ve(e) { | |
| let t = [], n; | |
| for (n = 0; n < 64; n += 4) | |
| t[n >> 2] = e.charCodeAt(n) + (e.charCodeAt(n + 1) << 8) + (e.charCodeAt(n + 2) << 16) + (e.charCodeAt(n + 3) << 24); | |
| return t | |
| } | |
| let z = "0123456789abcdef".split(""); | |
| function Ee(e) { | |
| let t = "" | |
| , n = 0; | |
| for (; n < 4; n++) | |
| t += z[e >> n * 8 + 4 & 15] + z[e >> n * 8 & 15]; | |
| return t | |
| } | |
| function Oe(e) { | |
| for (let t = 0; t < e.length; t++) | |
| e[t] = Ee(e[t]); | |
| return e.join("") | |
| } | |
| function Y(e) { | |
| return Oe(pe(e)) | |
| } | |
| let E = function(e, t) { | |
| return e + t & 4294967295 | |
| }; | |
| Y("hello") !== "5d41402abc4b2a76b9719d911017c592" && (E = function(e, t) { | |
| let n = (e & 65535) + (t & 65535); | |
| return (e >> 16) + (t >> 16) + (n >> 16) << 16 | n & 65535 | |
| } | |
| ); | |
| """ | |
| js=execjs.compile(jsStr) | |
| return js.call('cag', s) | |
| if __name__ == "__main__": | |
| headers={ | |
| 'Host': 'api.quanku.art', | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0', | |
| 'Accept': 'application/json, text/plain, */*', | |
| 'Accept-Language': 'en-US,en;q=0.5', | |
| 'Accept-Encoding': 'gzip, deflate, br', | |
| 'Content-Type': 'application/json', | |
| 'Origin': 'https://g2.ltfc.net', | |
| 'Connection': 'keep-alive', | |
| 'Sec-Fetch-Dest': 'empty', | |
| 'Sec-Fetch-Mode': 'no-cors', | |
| 'Sec-Fetch-Site': 'cross-site', | |
| 'Referer': 'https://g2.ltfc.net/', | |
| 'Pragma': 'no-cache', | |
| 'Cache-Control': 'no-cache' | |
| } | |
| root = 'png' | |
| urls = [ | |
| 'https://g2.ltfc.net/view/SUHA/62306be61ea663736403e7b2', | |
| #'https://g2.ltfc.net/view/SUHA/689c40907efdcf38c2c1f157', | |
| #'https://g2.ltfc.net/view/SUHA/647b36ade6ae1427f58f6ae2', # 蔡襄 东园柳色 | |
| #'https://g2.ltfc.net/view/SUHA/608a619faa7c385c8d943077', # 启功题宋拓争坐帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a4aa7c385c8d9435f6', # 争座位帖拓片 | |
| #'https://g2.ltfc.net/view/SUHA/609678b3e2d4222ecd8c2e25', # 争座位帖行书 | |
| #'https://g2.ltfc.net/view/SUHA/608a6c0fe11ca9610086057a', # 诸上座帖卷 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a6aa7c385c8d94386b', # 草书浣花溪图引卷 | |
| #'https://g2.ltfc.net/view/SUHA/608a61adaa7c385c8d944269', # 砥柱铭全卷 | |
| #'https://g2.ltfc.net/view/SUHA/609678aee2d4222ecd8c2d9c', # 寒山子庞居士诗 | |
| #'https://g2.ltfc.net/view/SUHA/6319ccbed0cdbb7645c3f99d', # 松风阁诗卷 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a4aa7c385c8d94358f', # 廉颇蔺相如列传 1 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a4aa7c385c8d943591', # 廉颇蔺相如列传 2 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a3aa7c385c8d94356c', # 梨花诗 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b3aa7c385c8d944ab8', # 花气薰人帖 | |
| #'https://g2.ltfc.net/view/SUHA/609678aee2d4222ecd8c2d9d', # 史翊正墓志铭 | |
| #'https://g2.ltfc.net/view/SUHA/609678aee2d4222ecd8c2d9e', # 郁孤台法帖 | |
| #'https://g2.ltfc.net/view/SUHA/609678b0e2d4222ecd8c2dcc', # 黄庭坚手札残本 | |
| #'https://g2.ltfc.net/view/SUHA/639abe8d4c46842c85032aaf', # 苦笋帖 | |
| #'https://g2.ltfc.net/view/SUHA/609672dd49c9632e51dd6a92', # 明文征滕王阁序 | |
| #'https://g2.ltfc.net/view/SUHA/608a619eaa7c385c8d942f15', # 清王澍积书岩帖 | |
| #'https://g2.ltfc.net/view/SUHA/638155e4a9d5ba5e3ee8d533', # 灵飞经滋惠堂刻本翻黑 | |
| #'https://g2.ltfc.net/view/SUHA/61fd8d69c48e91317ae1c9e0', # 曹全碑 | |
| #'http://g2.ltfc.net/view/SHIY/5fb14c14c837f3173590c3ed', # 山外山 | |
| #'https://g2.ltfc.net/view/SUHA/608a623042b4355c93c9026a', # 郭虚己墓志 | |
| #'https://g2.ltfc.net/view/SUHA/634bd6a18dd99a597b46cc73', # 澄心堂帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a619faa7c385c8d94306f', # 祭伯父文稿 | |
| #'https://g2.ltfc.net/view/SUHA/608a622d42b4355c93c8fed6', # 祭侄文稿 拓本 | |
| #'https://g2.ltfc.net/view/SUHA/6349167a92e5e82273faebfe', # 祭侄文稿 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a1aa7c385c8d9431f1', # 明 沈度 楷书敬斋箴页 | |
| #'https://g2.ltfc.net/view/SUHA/634bd6578dd99a597b46bd43', # 宋米芾致景文隰公尺牍 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d944922', # 紫金研帖 | |
| #'https://g2.ltfc.net/view/SUHA/6089867eaec69d5015f5f62e', # 研山铭 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448c3', # 李太师帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448c0', # 珊瑚帖 | |
| #'https://g2.ltfc.net/view/SUHA/60d5bb8e6155e14a09d16642', # 宋 米芾 业镜帖行草书 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d944921', # 张季明帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448bf', # 淡墨秋山诗帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448bd', # 清和帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b3aa7c385c8d9449e3', # 箧中帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448be', # 晋纸帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448bb', # 复官帖页 | |
| #'https://g2.ltfc.net/view/SUHA/608a6c0de11ca96100860389', # 参政帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a6c0ce11ca9610086030e', # 中秋登海岱楼作诗帖 | |
| #'https://g2.ltfc.net/view/SUHA/60898c24150e075281de7da3', # 甘露帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a6c0de11ca96100860397', # 陈揽帖行书 | |
| #'https://g2.ltfc.net/view/SUHA/6368f16d3c3268469707eb41', # 苕溪诗 | |
| #'https://g2.ltfc.net/view/SUHA/6253ca537f30be5518a8c44d', # 多景楼诗帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448c5', # 行书三札卷 | |
| #'https://g2.ltfc.net/view/SUHA/611bed6d0b9dfa5f38795275', # 书论书 米芾 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b3aa7c385c8d944972', # 苏轼 人来得书帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a619daa7c385c8d942da7', # 致季常尺牍 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b3aa7c385c8d944974', # 新岁展庆帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a4aa7c385c8d9435f9', # 楚颂帖及送家安国教授归成都诗 | |
| #'https://g2.ltfc.net/view/SUHA/6321f24c9a210d4df26f8996', # 黄州寒食帖 | |
| #'https://g2.ltfc.net/view/SUHA/609678c6e2d4222ecd8c308a', # 苏氏一门法书册 致道源 宝月 啜茶 | |
| #'https://g2.ltfc.net/view/SUHA/609678c6e2d4222ecd8c308b', # 贤牋牍册 | |
| #'https://g2.ltfc.net/view/SUHA/634393a6fbd12e51668fee8f', # 观海堂苏帖 | |
| #'https://g2.ltfc.net/view/SUHA/63db5f67067ed201a656ec90', # 次辩才韵诗行书 | |
| #'https://g2.ltfc.net/view/SUHA/63195936f6328c6af2269544', # 覆盆子帖 | |
| #'https://g2.ltfc.net/view/SUHA/609678c2e2d4222ecd8c3009', # 苏轼致主簿曹君尺牍 苏轼书南轩梦语 2 | |
| #'https://g2.ltfc.net/view/SUHA/608a619faa7c385c8d943037', # 冯承素行书摹兰亭序卷 | |
| #'https://g2.ltfc.net/view/SUHA/608a61acaa7c385c8d94408e', # 行书杂诗帖手卷六段 南宋 吴琚 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d944899', # 乡石帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d944923', # 逃暑帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d944920', # 岁丰帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a6aa7c385c8d94386d', # 蒙诏帖 | |
| #'https://g2.ltfc.net/view/SUHA/608a61aeaa7c385c8d9442e3', # 丧乱 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b3aa7c385c8d944ab7', # 宫使 | |
| #'https://g2.ltfc.net/view/SUHA/631a8ac1718b5209e5e23f8e', # 快雪时晴 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448ba', # 米芾 值雨 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a8aa7c385c8d943b59', # 黄庭坚 致明叔同年尺牍 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a3aa7c385c8d94356b', # 黄庭坚 尺牍全册 | |
| #'https://g2.ltfc.net/view/SUHA/60a319e189522252e30b99b5', # 尺牍(尊妗帖) | |
| #'https://g2.ltfc.net/view/SUHA/608a619daa7c385c8d942dad', # 宋范成大书尺牍 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448c8', # 《褚遂良摹兰亭序》跋赞行书 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448bc', # 册页全册 米芾 十 | |
| #'https://g2.ltfc.net/view/SUHA/608a61a4aa7c385c8d9435d3', # 宋四家尺牍纸本-米芾 三 | |
| #'https://g2.ltfc.net/view/SUHA/608a61b2aa7c385c8d9448c7', # 行草书盛制帖页 | |
| #'https://g2.ltfc.net/view/SUHA/608a6c0de11ca961008603f0', # 道德经 | |
| #'https://g2.ltfc.net/view/SUHA/609672dc49c9632e51dd6a20', # 赵孟頫 小楷洛神赋 册 | |
| #'https://g2.ltfc.net/view/SUHA/60894a02a4ea0d4be1e82cd7', # 胆巴碑 | |
| #'https://g2.ltfc.net/view/SUHA/608a6c0de11ca961008603ff', # 出师表 | |
| #'https://g2.ltfc.net/view/SUHA/609678cae2d4222ecd8c3104', # 金刚经 | |
| #'https://g2.ltfc.net/view/SUHA/608a6c1be11ca96100860cc6', # 佛说阿弥陀经 | |
| #'https://g2.ltfc.net/view/SUHA/6367428994104f3051d7ec85', # 汲黯传 | |
| #'https://g2.ltfc.net/view/SUHA/609678b3e2d4222ecd8c2e2b', # 佛遗教经 | |
| #'https://g2.ltfc.net/view/SUHA/608a619faa7c385c8d94303e', # 书谱 | |
| #'https://g2.ltfc.net/view/SUHA/608a619faa7c385c8d943044', # 自叙帖 | |
| ] | |
| for url in urls: | |
| if 'g2.ltfc.net' in url: | |
| # 第二代网页 | |
| method, Id = re.findall(r'/([A-Z]+)/(\w{24})', url)[0] | |
| res = requests.post('https://api.quanku.art/cag2.TouristService/getAccessToken',headers=headers) | |
| token = res.json()['token'] | |
| res = requests.post(f'https://api.quanku.art/cag2.{method.lower().capitalize()}Service/get', json={"Id": Id, "context":{"tourToken": token}},headers=headers) | |
| data = res.json() | |
| Id = data['hdp']['id'] | |
| title = data['name'] if 'name' in data else data['title'] | |
| # 清理空格 | |
| title=title.strip() | |
| if data['hdp']['src'] == 'COLL': | |
| # 多张 | |
| headers={ | |
| 'Host': 'api.quanku.art', | |
| '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', | |
| 'Accept': '*/*', | |
| 'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6', | |
| 'Accept-Encoding': 'gzip, deflate, br', | |
| 'Origin': 'https://g2.ltfc.net', | |
| 'Content-Type':'application/json', | |
| 'Connection': 'keep-alive', | |
| 'Sec-Fetch-Dest': 'empty', | |
| 'Sec-Fetch-Mode': 'cors', | |
| 'Sec-Fetch-Site': 'cross-site', | |
| 'Referer': 'https://g2.ltfc.net/', | |
| } | |
| Id=data['hdp']['id'] | |
| payload={ | |
| "src": "SUHA", | |
| "resourceId": Id, | |
| "context": { | |
| "tourToken": token, | |
| "appKey": "CAGWEB", | |
| "appSec": "ZETYK0B8KTQB41KYWA2" | |
| } | |
| } | |
| res = requests.post('https://api.quanku.art/cag2.TouristService/enter',json=payload,headers=headers) | |
| payload={ | |
| "Id": Id, | |
| "context": { | |
| "tourToken": token, | |
| "appKey": "CAGWEB", | |
| "appSec": "ZETYK0B8KTQB41KYWA2" | |
| } | |
| } | |
| res = requests.post('https://api.quanku.art/cag2.HDPicService/getHDPicOfColl',json=payload,headers=headers) | |
| #res = requests.post('https://api.quanku.art/cag2.HDPicService/getColl',json=payload,headers=headers) | |
| for i, item in enumerate(res.json()['data'], 1): | |
| print(f'\n第{i}副') | |
| print(item['resourceId']) | |
| ParsePNG({ | |
| 'root': os.path.join(root, title), | |
| 'title': os.path.splitext(item['name'])[0], | |
| 'uuid': item['resourceId'], | |
| 'totalWidth': item['size']['width'], | |
| 'totalHeight': item['size']['height'] | |
| }) | |
| time.sleep(10) | |
| else: | |
| # 单张 | |
| data = res.json() | |
| # snapUrl 缩略图 | |
| if 'snapUrl' in data and data['snapUrl']: | |
| uuid = re.findall(r'\w{24}', data['snapUrl'])[0] | |
| else: | |
| uuid = re.findall(r'\w{24}', data['thumbTileUrl'])[0] | |
| res = requests.post('https://api.quanku.art/cag2.HDPicService/get', json={'Id': Id},headers=headers) | |
| print(res) | |
| item = res.json() | |
| ParsePNG({ | |
| 'root': root, | |
| 'title': title, | |
| 'uuid': item['resourceId'], | |
| 'totalWidth': item['size']['width'], | |
| 'totalHeight': item['size']['height'] | |
| }) | |
| time.sleep(10) | |
| else: raise KeyError('暂不支持旧版') |
This file contains hidden or 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
| function L(e, t) { | |
| let n = e[0] | |
| , i = e[1] | |
| , o = e[2] | |
| , a = e[3]; | |
| n = h(n, i, o, a, t[0], 7, -680876936), | |
| a = h(a, n, i, o, t[1], 12, -389564586), | |
| o = h(o, a, n, i, t[2], 17, 606105819), | |
| i = h(i, o, a, n, t[3], 22, -1044525330), | |
| n = h(n, i, o, a, t[4], 7, -176418897), | |
| a = h(a, n, i, o, t[5], 12, 1200080426), | |
| o = h(o, a, n, i, t[6], 17, -1473231341), | |
| i = h(i, o, a, n, t[7], 22, -45705983), | |
| n = h(n, i, o, a, t[8], 7, 1770035416), | |
| a = h(a, n, i, o, t[9], 12, -1958414417), | |
| o = h(o, a, n, i, t[10], 17, -42063), | |
| i = h(i, o, a, n, t[11], 22, -1990404162), | |
| n = h(n, i, o, a, t[12], 7, 1804603682), | |
| a = h(a, n, i, o, t[13], 12, -40341101), | |
| o = h(o, a, n, i, t[14], 17, -1502002290), | |
| i = h(i, o, a, n, t[15], 22, 1236535329), | |
| n = g(n, i, o, a, t[1], 5, -165796510), | |
| a = g(a, n, i, o, t[6], 9, -1069501632), | |
| o = g(o, a, n, i, t[11], 14, 643717713), | |
| i = g(i, o, a, n, t[0], 20, -373897302), | |
| n = g(n, i, o, a, t[5], 5, -701558691), | |
| a = g(a, n, i, o, t[10], 9, 38016083), | |
| o = g(o, a, n, i, t[15], 14, -660478335), | |
| i = g(i, o, a, n, t[4], 20, -405537848), | |
| n = g(n, i, o, a, t[9], 5, 568446438), | |
| a = g(a, n, i, o, t[14], 9, -1019803690), | |
| o = g(o, a, n, i, t[3], 14, -187363961), | |
| i = g(i, o, a, n, t[8], 20, 1163531501), | |
| n = g(n, i, o, a, t[13], 5, -1444681467), | |
| a = g(a, n, i, o, t[2], 9, -51403784), | |
| o = g(o, a, n, i, t[7], 14, 1735328473), | |
| i = g(i, o, a, n, t[12], 20, -1926607734), | |
| n = f(n, i, o, a, t[5], 4, -378558), | |
| a = f(a, n, i, o, t[8], 11, -2022574463), | |
| o = f(o, a, n, i, t[11], 16, 1839030562), | |
| i = f(i, o, a, n, t[14], 23, -35309556), | |
| n = f(n, i, o, a, t[1], 4, -1530992060), | |
| a = f(a, n, i, o, t[4], 11, 1272893353), | |
| o = f(o, a, n, i, t[7], 16, -155497632), | |
| i = f(i, o, a, n, t[10], 23, -1094730640), | |
| n = f(n, i, o, a, t[13], 4, 681279174), | |
| a = f(a, n, i, o, t[0], 11, -358537222), | |
| o = f(o, a, n, i, t[3], 16, -722521979), | |
| i = f(i, o, a, n, t[6], 23, 76029189), | |
| n = f(n, i, o, a, t[9], 4, -640364487), | |
| a = f(a, n, i, o, t[12], 11, -421815835), | |
| o = f(o, a, n, i, t[15], 16, 530742520), | |
| i = f(i, o, a, n, t[2], 23, -995338651), | |
| n = m(n, i, o, a, t[0], 6, -198630844), | |
| a = m(a, n, i, o, t[7], 10, 1126891415), | |
| o = m(o, a, n, i, t[14], 15, -1416354905), | |
| i = m(i, o, a, n, t[5], 21, -57434055), | |
| n = m(n, i, o, a, t[12], 6, 1700485571), | |
| a = m(a, n, i, o, t[3], 10, -1894986606), | |
| o = m(o, a, n, i, t[10], 15, -1051523), | |
| i = m(i, o, a, n, t[1], 21, -2054922799), | |
| n = m(n, i, o, a, t[8], 6, 1873313359), | |
| a = m(a, n, i, o, t[15], 10, -30611744), | |
| o = m(o, a, n, i, t[6], 15, -1560198380), | |
| i = m(i, o, a, n, t[13], 21, 1309151649), | |
| n = m(n, i, o, a, t[4], 6, -145523070), | |
| a = m(a, n, i, o, t[11], 10, -1120210379), | |
| o = m(o, a, n, i, t[2], 15, 718787259), | |
| i = m(i, o, a, n, t[9], 21, -343485551), | |
| e[0] = E(n, e[0]), | |
| e[1] = E(i, e[1]), | |
| e[2] = E(o, e[2]), | |
| e[3] = E(a, e[3]) | |
| } | |
| function N(e, t, n, i, o, a) { | |
| return t = E(E(t, e), E(i, a)), | |
| E(t << o | t >>> 32 - o, n) | |
| } | |
| function h(e, t, n, i, o, a, r) { | |
| return N(t & n | ~t & i, e, t, o, a, r) | |
| } | |
| function g(e, t, n, i, o, a, r) { | |
| return N(t & i | n & ~i, e, t, o, a, r) | |
| } | |
| function f(e, t, n, i, o, a, r) { | |
| return N(t ^ n ^ i, e, t, o, a, r) | |
| } | |
| function m(e, t, n, i, o, a, r) { | |
| return N(n ^ (t | ~i), e, t, o, a, r) | |
| } | |
| function pe(e) { | |
| let t = e.length, n = [1732584193, -271733879, -1732584194, 271733878], i; | |
| for (i = 64; i <= e.length; i += 64) | |
| L(n, ve(e.substring(i - 64, i))); | |
| e = e.substring(i - 64); | |
| let o = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | |
| for (i = 0; i < e.length; i++) | |
| o[i >> 2] |= e.charCodeAt(i) << (i % 4 << 3); | |
| if (o[i >> 2] |= 128 << (i % 4 << 3), | |
| i > 55) | |
| for (L(n, o), | |
| i = 0; i < 16; i++) | |
| o[i] = 0; | |
| return o[14] = t * 8, | |
| L(n, o), | |
| n | |
| } | |
| function ve(e) { | |
| let t = [], n; | |
| for (n = 0; n < 64; n += 4) | |
| t[n >> 2] = e.charCodeAt(n) + (e.charCodeAt(n + 1) << 8) + (e.charCodeAt(n + 2) << 16) + (e.charCodeAt(n + 3) << 24); | |
| return t | |
| } | |
| let z = "0123456789abcdef".split(""); | |
| function Ee(e) { | |
| let t = "" | |
| , n = 0; | |
| for (; n < 4; n++) | |
| t += z[e >> n * 8 + 4 & 15] + z[e >> n * 8 & 15]; | |
| return t | |
| } | |
| function Oe(e) { | |
| for (let t = 0; t < e.length; t++) | |
| e[t] = Ee(e[t]); | |
| return e.join("") | |
| } | |
| function Y(e) { | |
| return Oe(pe(e)) | |
| } | |
| let E = function (e, t) { | |
| return e + t & 4294967295 | |
| }; | |
| Y("hello") !== "5d41402abc4b2a76b9719d911017c592" && (E = function (e, t) { | |
| let n = (e & 65535) + (t & 65535); | |
| return (e >> 16) + (t >> 16) + (n >> 16) << 16 | n & 65535 | |
| } | |
| ); | |
| console.log(Y("hello")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment