{"__ozon.ru":{"link":"(?:www\\.)?ozon\\.ru/(?:product/[\\w-]+|context/detail/id/\\d+)/.*","res":":\n// debugger;\nconst r = []\ntry {\n const title = (/<title.*?>(.+?)<\\/title>/.exec($._) || [])[1];\n\n // product images\n const regexp = new RegExp('<div data-index=\"\\\\d+\"[\\\\s\\\\S]+?<img loading=\"lazy\" src=\"(.+?)\"', 'gi');\n let m;\n while ((m = regexp.exec($._)) !== null) {\n let url = m[1];\n url = url.replace(/\\/\\w+50\\//, '/');\n r.push([url, title]);\n }\n\n // fallback image\n if (!r.length) {\n const url = ($._.match(/<meta.+data-hid=\"property::og:image\" content=\"(.+?)\"/) || [])[1];\n if (url) r.push([url, title]);\n }\n\n // reviews images\n const path = ($.base.match(/https?:\\/\\/(www\\.)?ozon.ru(\\/.+?)(\\?|$)/) || [])[2];\n const x = new XMLHttpRequest;\n x.open('POST', 'https://www.ozon.ru/api/composer-api.bx/widget/json/v2', false);\n x.send(JSON.stringify({\n \"asyncData\": btoa(JSON.stringify({\n \"url\": path,\n \"ci\": {\n \"id\": 1,\n \"name\": \"listReviewsDesktop\",\n \"vertical\": \"rpProduct\",\n \"version\": 1,\n \"params\":\n [\n { \"name\": \"paginationType\", \"text\": \"loadMoreButton\" },\n { \"name\": \"sortingType\", \"text\": \"created_at_desc\" },\n { \"name\": \"paramPageSize\", \"int\": 1000 },\n { \"name\": \"paramVariantModeEnabled\" },\n { \"name\": \"videoAllowed\", \"bool\": true }\n ]\n }\n })),\n \"extraBody\": {},\n \"url\": path + \"?tab=reviews&reviewsFilters=eyJ3aXRoUGhvdG9zIjp0cnVlfQ&sort=created_at_desc\",\n \"componentName\": \"listReviewsDesktop\"\n }));\n\n JSON.parse(x.responseText).state.reviews.forEach(f => {\n const c = f.content;\n c.photos.forEach(p => {\n const text = [c.score + '⭐'];\n if (c.comment) text.push(c.comment);\n if (c.positive) text.push('👍🏻 ' + c.positive);\n if (c.negative) text.push('👎🏻 ' + c.negative);\n r.push([p.url, text.join(' | ')]);\n });\n });\n\n} catch (e) {}\n\nreturn r;\n","img":"(cdn\\d\\.ozone\\.ru/s3/(rp-photo-\\d|multimedia-\\w)/)wc\\d+/(.+\\.jpe?g)","to":"$1$3"}} |