Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"Hitomi.la-x-p": {"link":"^hitomi\\.la\\/.+?(\\d+)\\.html#?(\\d*)", "res":":\nfunction getPageText(url) {\n const x = new XMLHttpRequest();\n x.open('GET', url, false);\n x.send();\n return x.responseText;\n}\n\n\nfunction parseGgjs(page) {\n\n const m = {};\n\n const caseRegex = /case\\s+(\\d+):(?:\\s*o\\s*=\\s*(\\d+))?/g;\n let keys = [];\n let match;\n while ((match = caseRegex.exec(page)) !== null) {\n const key = parseInt(match[1], 10);\n const value = match[2] ? parseInt(match[2], 10) : null;\n\n keys.push(key);\n\t\t\n if (value !== null) {\n\t\t\t// cast the key to a string since `gg.s()` returns a string\n keys.forEach(k => m[k.toString()] = value);\n keys = [];\n }\n }\n\n const ifRegex = /if\\s+\\(g\\s*===?\\s*(\\d+)\\)[\\s{]*o\\s*=\\s*(\\d+)/g;\n while ((match = ifRegex.exec(page)) !== null) {\n m[parseInt(match[1], 10)] = parseInt(match[2], 10);\n }\n\n const defaultMatch = page.match(/(?:var\\s|default:)\\s*o\\s*=\\s*(\\d+)/);\n const defaultValue = defaultMatch ? parseInt(defaultMatch[1], 10) : 0;\n\n const bMatch = page.match(/b:\\s*[\"'](.+?)[\"']/);\n const b = bMatch ? bMatch[1].replace(/^\\/|\\/$/g, '') : null;\n\n return [m, b, defaultValue];\n}\n\n\n\nconst urlDomain = '.gold-usergeneratedcontent.net/'\n\nlet ggjs = getPageText('https://ltn' + urlDomain + 'gg.js');\neval(ggjs.match(/(gg = .*)/s)[1]);\n\nconst [m, b, defaultValue ] = parseGgjs(ggjs);\n\nvar galleryId=$[1];\n\neval(getPageText('https://ltn' + urlDomain + 'galleries/' + galleryId + '.js'));\n\n\n//Differentiate between gallery links and image links\nlet pageint = $[2] == \"\" ? -1 : parseInt($[2]);\n\nlet res=[];\nfor (let i=0; i<galleryinfo.files.length; i++) {\n \n if(pageint != -1 && pageint != i + 1)\n continue;\n\n let img = galleryinfo.files[i];\n\n // TODO: figure out the `avif` file url\n //let imtype;\n //if(img.hasavif == 1) {\n // imType = \"avif\";\n //}\n //else {\n // imType = \"webp\";\n //}\n let imType = 'webp'\n \n let imHash = img.hash;\n let imNum = gg.s(imHash)\n // The left operand SHOULD just be the first letter of the filetype\n // e.g. `imtype[0]`, but it 404's using `a[vif]`\n let subDomain = 'w' + ((m[imNum] ?? defaultValue) + 1)\n \n let link = \"https://\" + subDomain + urlDomain + b + '/' + imNum + '/' + imHash + '.' + imType;\n \n console.debug(link);\n\n res.push([link]);\n}\n\nreturn res;\n", "note":"iceiller9999 (updated by Atlamillias)\nhttps://www.reddit.com/r/imagus/comments/102rqm3/comment/j3koy3a\nOLD\nhttp://forum.ru-board.com/topic.cgi?forum=5&topic=48222&start=3840#20\n\n\nEXAMPLES\nhttps://hitomi.la/artist/akutabin-all.html\nhttps://hitomi.la/series/arcana%20heart-all.html\nhttps://hitomi.la/tag/male%3Aexposed%20clothing-all.html"}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement