当前位置: 首页 > news >正文

【UE】自动添加Megascans所有资产到自己的账户

1. 复制如下代码:

((async (startPage = 0, autoClearConsole = true) => {const getCookie = (name) => {const value = `; ${document.cookie}`;const parts = value.split(`; ${name}=`);if (parts.length === 2) return parts.pop().split(';').shift();}const callCacheApi = async (params = {}) => {const defaultParams = {page: 0,maxValuesPerFacet: 1000,hitsPerPage: 1000,attributesToRetrieve: ["id", "name"].join(",")}const response = await fetch("https://proxy-algolia-prod.quixel.com/algolia/cache", {"headers": {"x-api-key": "2Zg8!d2WAHIUW?pCO28cVjfOt9seOWPx@2j"},"body": JSON.stringify({url: "https://6UJ1I5A072-2.algolianet.com/1/indexes/assets/query?x-algolia-application-id=6UJ1I5A072&x-algolia-api-key=e93907f4f65fb1d9f813957bdc344892",params: new URLSearchParams({ ...defaultParams, ...params }).toString()}),"method": "POST",})return await response.json()}const callAcl = async ({ id, name }) => {const response = await fetch("https://quixel.com/v1/acl", {"headers": {"authorization": "Bearer " + authToken,"content-type": "application/json;charset=UTF-8",},"body": JSON.stringify({ assetID: id }),"method": "POST",});const json = await response.json()if (json?.isError) {console.error(`  --> **UNABLE TO ADD ITEM** Item ${id} | ${name} (${json?.msg})`)} else {console.log(`  --> ADDED ITEM Item ${id} | ${name}`)}}const callAcquired = async () => {const response = await fetch("https://quixel.com/v1/assets/acquired", {"headers": {"authorization": "Bearer " + authToken,"content-type": "application/json;charset=UTF-8",},"method": "GET",});return await response.json()}// 1. Check token exist, quixel API needs itconsole.log("-> Checking Auth API Token...")let authToken = ""try {const authCookie = getCookie("auth") ?? "{}"authToken = JSON.parse(decodeURIComponent(authCookie))?.tokenif (!authToken) {return console.error("-> Error: cannot find authentication token. Please login again.")}} catch (_) {return console.error("-> Error: cannot find authentication token. Please login again.")}// 2. Get all currently acquired itemsconsole.log("-> Get Acquired Items...")const acquiredItems = (await callAcquired()).map(a => a.assetID)// 3. Get total count of itemsconsole.log("-> Getting Total Number of Pages....")const { nbPages: totalPages, hitsPerPage: itemsPerPage, nbHits: totalItems } = await callCacheApi()console.log("-> ==============================================")console.log(`-> Total # of items: ${totalItems}`)console.log(`-> ${totalPages} total pages with ${itemsPerPage} per page`)console.log(`-> Total Items to add: ${(totalItems - acquiredItems.length)}.`)console.log("-> ==============================================")if (!confirm(`Click OK to start adding ${(totalItems - acquiredItems.length)} items in your account.`)) return// Loopfor (let pageIdx = startPage || 0; pageIdx < totalPages; pageIdx++) {console.log(`-> ======================= PAGE ${pageIdx + 1}/${totalPages} START =======================`)console.log("-> Getting Items from page " + (pageIdx + 1) + " ...")const { hits: items } = await callCacheApi({ page: pageIdx })console.log("-> Adding non-acquired items...")// Filter out owned itemsconst unownedItems = items.filter(i => !acquiredItems.includes(i.id))const aclPromises = unownedItems.map(callAcl)await Promise.all(aclPromises)console.log(`-> ======================= PAGE ${pageIdx + 1}/${totalPages} COMPLETED =======================`)if (autoClearConsole) console.clear() // Fix the issue that too much log hangs the console. Set autoClearConsole = false to keep the logs}console.log("-> Getting new acquired info...")// Get acquired items againconst newItemsAcquired = (await callAcquired()).lengthconst newTotalCount = (await callCacheApi()).nbHitsconsole.log(`-> Completed. Your account now have a total of ${newItemsAcquired} out of ${newTotalCount} items.`)alert(`-> Your account now have a total of ${newItemsAcquired} out of ${newTotalCount} items.\n\nIf you find some items missing, try refresh the page and run the script again.`)
})())

2. 打开 Quixel官网并登陆

3. 进入Quixel Megascans

4. 在第3步的网页中,按F12进入控制台,然后点击“Console”,将第1步复制的代码粘贴到控制台中,然后回车。在弹出的提示框中点击确定,然后等待脚本把所有资产都加入到你的库存(不会占用电脑内存)

参考文章:

https://gist.github.com/jamiephan/0c04986c7f2e62d5c87c4e8c8ce115fc

http://www.lryc.cn/news/456586.html

相关文章:

  • 【函数】4.函数的单调性
  • 网格剖分-耳切法效果展示
  • 电磁力、强相互作用力、弱相互作用力、强核力,以及它们之间的关系
  • 2.安装keepalived详细过程
  • 面试题1-fail-safe机制与fail-fast 机制
  • C/C++复习(一)
  • iOS Object-C 将数组倒置(倒叙)
  • 动态轻量级线程池项目
  • 【AI知识点】批归一化(Batch Normalization)
  • 【低代码】前端低代码开发日记2:遇到的问题(1)双向绑定
  • 10.9作业
  • Go 语言中的错误和异常:设计理念与优势
  • sqli-labs less-20 less-21 less-22 cookie注入
  • IDEA下“File is read-only”可能原因及“找不到或无法加载主类”问题的解决
  • MySQL【知识改变命运】03
  • 【测试】BUG篇——BUG
  • 【高阶数据结构】深度探索二叉树进阶:二叉搜索树概念及其高效实现
  • 上传本地项目到GitHub远程仓库(极简洁操作版)
  • 在安卓中使用 `mobile-ffmpeg` 压缩后的视频,浏览器在线播放提示“没有找到支持的视频格式和 MIME 类型”的解决方案
  • C语言指针plus版练习
  • Kafka 快速入门
  • 探索人们最喜爱的AI工具及其应用影响
  • c语言位域详解
  • 如何修改Spring Boot内置容器默认端口
  • STM32自动下载电路分享及注意事项
  • 【深度学习基础模型】极限学习机(Extreme Learning Machines, ELM)详细理解并附实现代码。
  • 把交换机的两个接口连接起来会怎么样?
  • 无人机陆空双模式。
  • 14. 文档对象模型
  • 【计网】【计网】从零开始学习http协议 ---理解http重定向和请求方法