Advertisement
Guest User

Untitled

a guest
Jun 13th, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.81 KB | None | 0 0
  1. {"PINTEREST-g":{"link":"^(?:[a-z]{2}\\.)?pinterest(?:\\.[a-z]{2,3}){1,2}/pin/[\\w-]+/$","ci":3,"loop":3,"res":":\nconst re =\n /(?:\"__PWS_INITIAL_PROPS__\"|data-relay-response=\"true\") type=\"application\\/json\">(?<data>.+?)<\\/script>/g;\nlet jsons;\ntry {\n jsons = [...$._.matchAll(re)].map(data => JSON.parse(data.groups.data));\n if (jsons.length === 0) throw new Error('No data found');\n} catch (error) {\n console.error('Failed to parse jsons');\n console.error('Post error on /r/imagus');\n return;\n}\n\n// If media link has a matching sieve, use that instead.\nconst link = jsons[1]?.response?.data?.v3GetPinQuery?.data?.link;\nconst loop = !/\\.pin(?:terest|img)\\.com\\//.test(link)&&this.find({href: link});\nif(loop !== false && loop !== '')return {loop:link};\n\nconst json =\n jsons.find(\n // Initialreduxstate has data when logged in.\n json =>\n typeof json?.initialReduxState?.pins === 'object' &&\n Object.keys(json.initialReduxState.pins) > 0\n )?.initialReduxState?.pins || null;\n\nlet data;\ndata = json ? json[Object.keys(json)[0]] : null;\ndata =\n data ||\n (\n jsons.find(json => {\n json?.requestParameters?.name === 'CloseupStoryPinQuery' ||\n json?.requestParameters?.name === 'CloseupDetailQuery';\n }) || jsons[jsons.length - 1]\n )?.response?.data?.v3GetPinQuery?.data;\n\n\nif (!data) {\n console.error('Pinterest object likely changed.');\n console.error('Post error on /r/imagus');\n return;\n}\n\nconst getImg = data => {\n return (\n data?.images?.orig?.url ||\n data?.images?.orig?.['1200x'] || // Logged In\n data?.images?.orig?.['750x'] ||\n data?.images?.orig?.['736x'] ||\n data?.images?.orig?.['564x'] ||\n data?.images?.orig?.['474x'] ||\n data?.images?.orig?.['236x'] ||\n data?.image?.images?.['originals']?.url || // Story Images Logged In\n data?.image?.images?.['1200x']?.url ||\n data?.image?.images?.['736x']?.url ||\n data?.image?.images?.['564x']?.url ||\n data?.image?.images?.['474x']?.url ||\n data?.image?.images?.['236x']?.url ||\n data?.imageSpec_orig?.url || // Logged Out\n data?.imageSpec_1200x?.url ||\n data?.imageSpec_750x?.url ||\n data?.imageSpec_736x?.url ||\n data?.imageSpec_564x?.url ||\n data?.imageSpec_474x?.url ||\n data?.imageSpec_236x?.url ||\n data?.imageSpec_170x?.url\n );\n};\n\nconst getVid = block => {\n return (\n block?.video?.video_list?.['V_EXP7']?.url || // Logged In\n block?.video?.video_list?.['V_EXP6']?.url ||\n block?.video?.video_list?.['V_EXP5']?.url ||\n block?.video?.video_list?.['V_EXP4']?.url ||\n block?.video?.video_list?.['V_EXP3']?.url ||\n block?.video?.video_list?.['V_HLSV3_MOBILE']?.url ||\n block?.videoData?.videoList1080P?.v1080p?.url || // Logged Out\n block?.videoData?.videoList720P?.v720P?.url ||\n block?.videoData?.videoListMobile?.vHLSV3MOBILE?.url\n );\n};\n//\n\nconst title = data?.gridTitle || data?.grid_title || '';\nconst storyData = data?.storyPinData || data?.story_pin_data;\n\nconst storyList =\n (storyData &&\n storyData.pages\n .map(el =>\n el?.blocks?.[0]?.__typename === 'StoryPinVideoBlock' ||\n el?.blocks?.[0]?.type === 'story_pin_video_block'\n ? getVid(el?.blocks?.[0])\n : getImg(el?.blocks?.[0])\n )\n .filter(el => el)\n .map(url => [url, title])) ||\n [];\n// Return story album if it exists.\nif (storyList.length) return storyList;\n\nconst videoObj = data?.videos?.videoList || data?.videos?.video_list || {};\nconst videoList = Object.keys(videoObj)\n .filter(key => videoObj[key].url)\n .map(key => ({\n url: videoObj[key].url,\n height: videoObj[key].height,\n }))\n .filter(vid => vid.url.endsWith('.mp4'))\n .sort((a, b) => b.height - a.height);\n// Return video if it exists\nif (videoList.length) return [videoList[0].url, title];\n\nconst img = getImg(data);\n// Otherwise return a single image.\nreturn img && [img, title];\n","img":"^(?:((?:i|(?:s-)?media-c(?:dn|ache\\D*)\\d*)\\.pin(?:terest|img)\\.com/)(?:(upload/\\d+_[^\\W_]{8})_[bft]|(?!550)\\d+x?\\d*(?:_[^/]+)?/|(avatars/[^.]+[_-]\\d+)(?:_(?!600)[^.]+)?(?=\\.))(.*)|blob:https://(?:[a-z]{2,3}\\.)?pinterest\\.com/[a-f0-9-]{36})","to":":\n// check if this is a video pin\nconst pin = this.TRG.closest('[data-test-id=\"pin\"]');\nif (pin?.querySelector('[data-test-id^=\"pincard-video\"], [data-test-id=\"pinrep-video\"]')) {\n return `https://ru.pinterest.com/pin/${pin.dataset.testPinId}/`\n}\nif($[1]) return $[1] + ($[2] ? $[2] : ($[3] ? $[3].replace(/(\\d+)_\\d+$/, '$1') + '_600' : '#originals 736x 564x#/' + $[4]))\nvar n=this.node, p=document.evaluate('./ancestor::a[starts-with(@href,\"/pin/\")]//img[contains(@src,\"pinimg.com\")]',n,null,9,null).singleNodeValue\np=p?this.find({src: p.src, IMGS_TRG: n}):''\nreturn (Array.isArray(p) ? p.join('\\n') : (p === null ? 'null' : p)) || ''","note":"numso531+Imagus_fan (edit)\nhttps://www.reddit.com/r/imagus/comments/1kddg04/comment/mqcm0zq\nOLD\nhttps://www.reddit.com/r/imagus/comments/1kddg04/comment/mqcasjl\nhttps://www.reddit.com/r/imagus/comments/z0zyox/comment/mcm8nw4\n\n\n!!!\nIn order for the sieve to work correctly, you need to install the uBO (uBlock Origin) extension:\nIn uBO Settings -> My Filters -> Add this filters:\npinterest.com##a[href^=\"/pin/\"]:has(video, img[src*=\"pinimg\"]):style(position: relative;)\npinterest.com##a[href^=\"/pin/\"]:has(video, img[src*=\"pinimg\"])::after:style(width: 100%; height: 100%; position: absolute; top: 0; left: 0; content: '';)\npinterest.com##div[data-test-id*=\"-hover-overlay\"]:upward(div[style=\"cursor: pointer; z-index: 1;\"],div[style^=\"background-color: rgba\"])\n\n\nПРИМЕРЫ / EXAMPLES\nhttps://pinterest.com/\nhttps://www.reddit.com/domain/pinterest.com/new/\nhttps://pinterest.com/search/pins/?q=cackes&rs=typed\nhttps://pinterest.com/StevieMPD/sasha-holland-shirogane-sama/"}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement