Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2024
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. {"OZON.ru":{"link":"^(ozon\\.ru/(?:product/[\\w-]+|context/detail/id/\\d+))/.*?(?:\\?|$)","res":":\nconst r = []\ntry {\n if (!$[0].includes('/reviews')) {\n const doc = new DOMParser().parseFromString($._, \"text/html\");\n const title = doc.querySelector('title').textContent;\n\n // product images\n let data = JSON.parse(doc.querySelector('div[id^=\"state-webGallery-\"]').dataset.state);\n data.images?.forEach(i => r.push([i.src, i.alt || title]));\n data.videos?.forEach(v => r.push([v.url, v.name || title]));\n }\n\n // reviews images\n const rUrl = $[0].match(/^(.+?\\/product\\/[\\w-]+)(\\/|$)/)?.[1] + '/reviews/?sort=usefullness_desc';\n const x = new XMLHttpRequest;\n x.open('GET', rUrl, false);\n x.send();\n const data = JSON.parse(x.responseText?.match(/<div id=\"state-webListReviews.+?data-state='(.+?)'/i)[1]);\n\n data.reviews.forEach(f => {\n const c = f.content;\n [...c.photos||[], ...c.videos||[]].forEach(p => {\n const text = ['&#11088;' + c.score];\n if (c.comment) text.push(c.comment);\n if (c.positive) text.push('&#128077;&#127995; ' + c.positive);\n if (c.negative) text.push('&#128078;&#127995; ' + c.negative);\n if (f.createdAt) text.push(new Date(f.createdAt*1000).toISOString().substring(0,10))\n r.push([p.url, text.join(' | ')]);\n });\n });\n} catch (e) {\n console.error(e);\n}\n\nlet hasVideo = false;\nr.forEach(item => {\n if (item[0].endsWith('.m3u8')) {\n hasVideo = true;\n item[1] = `<imagus-extension type=\"videojs\" url=\"${item[0]}\"></imagus-extension>${item[1]}`;\n item[0] = '';\n }\n});\nif (hasVideo) {\n this.TRG.IMGS_ext_data = r;\n return { loop: 'imagus://extension' };\n}\n\nreturn r;","img":"((?:ir(?:-\\d)?|cdn\\d)\\.ozone\\.ru/s3/(rp-photo-\\d+|multimedia-\\w+|video[-\\d]*)/)(?:wc\\d+/)?(.+\\.jpe?g)","loop":2,"to":":\nif (!this.getImages_original) {\n this.getImages_original = this.getImages;\n this.getImages = (el) => this.getImages_original(el?.firstElementChild?.nodeName == 'IMG' ? el.firstElementChild: el);\n}\n\nif ($[2]?.startsWith('video')) {\n if (!$[2].includes('-')) $[2] += '-7';\n let id = /[0-9A-Z]{20,}/.exec($[0])[0];\n return `https://v.ozone.ru/vod/${$[2]}/${id}/master.m3u8`;\n} else {\n return $[1] + $[3];\n}","note":"hababr\nhttp://forum.ru-board.com/topic.cgi?forum=5&topic=50874&start=2480#7\nOLD\nhttp://forum.ru-board.com/topic.cgi?forum=5&topic=50874&start=2238&limit=1&m=1#1\nhttp://forum.ru-board.com/topic.cgi?forum=5&topic=50874&start=2080#7\n\n\n!!!\nВ поисковой выдаче подгружает не только фото товара, но и фото сделанные покупателями + отзывы.\n+\nКурсор рекомендуется наводить на описание товара.\n\n\nПРИМЕРЫ\nhttps://www.ozon.ru/category/noutbuki-15692/\nhttps://www.ozon.ru/search/?deny_category_prediction=true&from_global=true&text=Сетка+антимоскитная+на+дверь&product_id=263132888\nhttps://www.ozon.ru/category/stiralnyy-poroshok-14585/"}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement