Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions Pagetual/pagetualRules.json
Original file line number Diff line number Diff line change
Expand Up @@ -6489,13 +6489,14 @@
"action": 2
},
{
"name": "xHamster",
"url": "^https://([\\w]+\\.)?(xhamster|xhaccess|xhamster19)\\.(com|desi)/",
"author": "Vieller",
"pageElement": "//div[contains(@class, 'thumb-list__item') and not(contains(@class, 'loading'))]",
"nextLink": "//a[@data-page='next' or @rel='next']",
"action": 0,
"pageInit": "let candidates = Array.from(document.querySelectorAll('.thumb-list__item')); let bestCandidate = candidates.find(c => c.querySelector('[data-role=\"video-duration\"]')); if (!bestCandidate && candidates.length) bestCandidate = candidates[0]; if (!window._pagetualMasterTemplate) { if (bestCandidate) { window._pagetualMasterTemplate = bestCandidate.innerHTML; let durationSpan = bestCandidate.querySelector('[data-role=\"video-duration\"] [class*=\"tiny-\"]'); if (durationSpan) { let tinyClass = Array.from(durationSpan.classList).find(c => c.startsWith('tiny-')); if (tinyClass) { let suffix = tinyClass.split('-').pop(); if (suffix) window._pagetualSuffix = suffix; } } } } let inner = window._pagetualMasterTemplate || (bestCandidate ? bestCandidate.innerHTML : ''); if (!inner) return; if (!window._pagetualSuffix) window._pagetualSuffix = '8643e'; let script = doc.querySelector('script#initials-script'); if (!script) { script = Array.from(doc.querySelectorAll('script')).find(s => s.textContent.includes('window.initials=')); } if (!script) return; let scriptText = script.textContent; let match = scriptText.match(/window\\.initials\\s*=\\s*(\\{[\\s\\S]*?\\});/); if (!match) return; let jsonStr = match[1]; let initials; try { initials = eval('(' + jsonStr + ')'); } catch (e) { return; } function find(obj, depth) { if (depth > 10) return null; if (!obj || typeof obj !== 'object' || Array.isArray(obj)) return null; if (obj.videoThumbProps?.length) return obj.videoThumbProps; for (let k in obj) if (obj.hasOwnProperty(k)) { let r = find(obj[k], depth + 1); if (r) return r; } return null; } let props = find(initials, 0); if (!props?.length) return; function formatDuration(s) { let h = Math.floor(s / 3600), m = Math.floor((s % 3600) / 60), sec = s % 60; if (h) return h + ':' + (m < 10 ? '0' + m : m) + ':' + (sec < 10 ? '0' + sec : sec); return m + ':' + (sec < 10 ? '0' + sec : sec); } function round(value, precision) { let multiplier = Math.pow(10, precision || 0); return Math.round(value * multiplier) / multiplier; } function formatViews(v) { if (v >= 1e6) return round(v / 1e6, 1) + 'M'; if (v >= 1e3) return round(v / 1e3, 1) + 'K'; return v.toString(); } for (let ele of eles) { let id = ele.getAttribute('data-video-id'); if (!id) continue; let data = props.find(p => p.id == id); if (!data) continue; let div = document.createElement('div'); div.innerHTML = inner; let noscripts = div.querySelectorAll('noscript'); for (let ns of noscripts) ns.remove(); let link = div.querySelector('a[data-role=\"thumb-link\"]'); if (link && data.pageURL) { link.href = data.pageURL; link.setAttribute('data-previewvideo', data.trailerURL || ''); link.setAttribute('aria-label', data.title || ''); } let img = div.querySelector('img.thumb-image-container__image'); if (img) { img.src = data.imageURL; img.srcset = data.thumbURL; img.alt = data.title || ''; } let sprite = div.querySelector('.thumb-image-container__sprite'); if (sprite) { sprite.setAttribute('data-sprite', data.spriteURL || ''); sprite.id = id; } let durationSpan = div.querySelector('[data-role=\"video-duration\"] [class*=\"tiny-\"]'); if (durationSpan) durationSpan.textContent = formatDuration(data.duration); let uhd = div.querySelector('.xh-icon'); if (uhd && !data.isUHD) uhd.style.display = 'none'; let titleLink = div.querySelector('.video-thumb-info__name'); if (titleLink && data.pageURL) { titleLink.href = data.pageURL; titleLink.title = data.title || ''; titleLink.textContent = data.title || ''; } let uploaderData = div.querySelector('.video-uploader-data'); if (uploaderData) { if (data.landing && data.landing.name) { let logo = uploaderData.querySelector('.video-uploader-logo'); if (logo && data.landing.link) { logo.href = data.landing.link; logo.textContent = data.landing.name.charAt(0).toUpperCase(); } let name = uploaderData.querySelector('.video-uploader__name'); if (name && data.landing.link) { name.href = data.landing.link; name.textContent = data.landing.name; } } else { let logo = uploaderData.querySelector('.video-uploader-logo'); if (logo) logo.remove(); let name = uploaderData.querySelector('.video-uploader__name'); if (name) name.remove(); let sep = uploaderData.querySelector('.video-thumb-uploader__separator'); if (sep) sep.remove(); } } let viewsSpan = div.querySelector('.video-thumb-views'); if (viewsSpan) viewsSpan.textContent = formatViews(data.views) + ' views'; let onVideo = div.querySelector('.thumb-image-container__on-video'); if (onVideo) onVideo.style.zIndex = '20'; if (data.isWatched) { if (onVideo && !onVideo.querySelector('.thumb-image-container__watched')) { let w = document.createElement('div'); w.className = 'thumb-image-container__watched'; w.setAttribute('data-role', 'video-watched'); let tinyBold = 'tiny-bold-' + window._pagetualSuffix; let invert = 'invert-' + window._pagetualSuffix; w.innerHTML = `<div class=\"${tinyBold} ${invert}\">Watched</div>`; if (onVideo.firstChild) onVideo.insertBefore(w, onVideo.firstChild); else onVideo.appendChild(w); } } if (data.hasProducerBadge) { let a = div.querySelector('a[data-role=\"thumb-link\"]'); if (a && !a.querySelector('.thumb-image-container__badge')) { let b = document.createElement('div'); b.className = 'thumb-image-container__badge'; b.setAttribute('data-role-producer-badge', ''); b.setAttribute('data-brand', 'full video'); b.innerHTML = '<span class=\"badge-producer\"></span>'; a.appendChild(b); } } while (ele.firstChild) ele.removeChild(ele.firstChild); while (div.firstChild) ele.appendChild(div.firstChild); }",
"pageAction": "eles.forEach(container => { let anchor = container.querySelector('a[data-role=\"thumb-link\"]'); if (!anchor) return; let trailerUrl = anchor.getAttribute('data-previewvideo'); if (!trailerUrl) return; if (getComputedStyle(anchor).position !== 'relative') anchor.style.position = 'relative'; let videoElem = null; anchor.addEventListener('mouseenter', () => { if (videoElem) return; videoElem = Object.assign(document.createElement('video'), { src: trailerUrl, loop: true, muted: true, autoplay: true, playsInline: true }); Object.assign(videoElem.style, { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', objectFit: 'cover', zIndex: 10, pointerEvents: 'none', backgroundColor: 'black' }); anchor.appendChild(videoElem); videoElem.play(); }); anchor.addEventListener('mouseleave', () => { if (!videoElem) return; videoElem.pause(); videoElem.remove(); videoElem = null; }); });"
}
"name": "xHamster",
"url": "^https://([\\w]+\\.)?(xhamster|xhaccess|xhamster19)\\.(com|desi)/",
"author": "Vieller",
"pageElement": "div[data-ecommerce-list-name=\"default\"] div[class*=\"thumb-list__item\"]:not([class*=\"loading\"]), div[data-role=\"video-section-content-role\"] div[class*=\"thumb-list__item\"]:not([class*=\"loading\"]), div[class*=\"galleryList\"] > div[class*=\"container\"] > div[class*=\"wrapper\"], div[class*=\"content\"] div[class*=\"wrapper-\"], div[class*=\"content\"] div[class*=\"default\"], [class*=\"photosList\"] > div[style]",
"nextLink": "a[data-page='next'], a[rel='next']",
"action": 0,
"init": "let candidates = Array.from(document.querySelectorAll('.thumb-list__item')); let bestCandidate = candidates.find(c => c.querySelector('[data-role=\"video-duration\"]')); if (!bestCandidate && candidates.length) bestCandidate = candidates[0]; if (!window._pagetualMasterTemplateVideo) { if (bestCandidate) { let clone = bestCandidate.cloneNode(true); let badgeElements = clone.querySelectorAll('[data-role=\"video-watched\"], [data-brand=\"full video\"]'); badgeElements.forEach(badge => badge.remove()); let xhIcons = clone.querySelectorAll('.xh-icon'); xhIcons.forEach(icon => icon.remove()); window._pagetualMasterTemplateVideo = clone.innerHTML; let durationSpan = clone.querySelector('[data-role=\"video-duration\"] [class*=\"tiny-\"]'); if (durationSpan) { let tinyClass = Array.from(durationSpan.classList).find(c => c.startsWith('tiny-')); if (tinyClass) { let suffix = tinyClass.split('-').pop(); if (suffix) window._pagetualSuffix = suffix; } } } } if (!window._pagetualMasterGallery) { let galleryCandidates = Array.from(document.querySelectorAll('[class*=\"container-\"] > [class*=\"wrapper\"]')); if (!galleryCandidates.length) galleryCandidates = Array.from(document.querySelectorAll('div[class*=\"wrapper\"]')).filter(el => el.querySelector('[class*=\"author-\"]')); let bestGallery = galleryCandidates.find(g => g.querySelector('[class*=\"author-\"]')); if (!bestGallery && galleryCandidates.length) bestGallery = galleryCandidates[0]; if (bestGallery) { let clone = bestGallery.cloneNode(true); window._pagetualMasterGallery = clone.innerHTML; let captionSpan = clone.querySelector('[class*=\"caption-\"]'); if (captionSpan) { let captionClass = Array.from(captionSpan.classList).find(c => c.startsWith('caption-')); if (captionClass) window._pagetualCaptionSuffix = captionClass.split('-').pop(); } let bodySpan = clone.querySelector('[class*=\"body-bold-\"]'); if (bodySpan) { let bodyClass = Array.from(bodySpan.classList).find(c => c.startsWith('body-bold-')); if (bodyClass) window._pagetualBodySuffix = bodyClass.split('-').pop(); } } } if (!window._pagetualSuffix) window._pagetualSuffix = '8643e'; if (!window._pagetualCaptionSuffix) window._pagetualCaptionSuffix = '8643e'; if (!window._pagetualBodySuffix) window._pagetualBodySuffix = '8643e';",
"pageInit": "/* Extract data from window.initials and handle different page types */ let script = doc.querySelector('script#initials-script'); if (!script) { script = Array.from(doc.querySelectorAll('script')).find(s => s.textContent.includes('window.initials=')); } if (!script) return; let scriptText = script.textContent; let match = scriptText.match(/window\\.initials\\s*=\\s*(\\{[\\s\\S]*?\\});/); if (!match) return; let jsonStr = match[1]; let initials; try { initials = eval('(' + jsonStr + ')'); } catch (e) { return; } /* Photo galleries main page – remove skeleton overlays only */ if (initials.photosPage !== undefined || initials.galleryPage !== undefined) { for (let ele of eles) { let skeleton = ele.querySelector('a[class*=\"cover\"] > div[class*=\"container-\"][class*=\"primaryColor-\"]'); if (skeleton && skeleton.querySelector('span[class*=\"dot\"]')) { skeleton.remove(); } } return; } function round(value, precision) { let multiplier = Math.pow(10, precision || 0); return Math.round(value * multiplier) / multiplier; } function formatViews(v) { if (v >= 1e6) return round(v / 1e6, 1) + 'M'; if (v >= 1e3) return round(v / 1e3, 1) + 'K'; return v.toString(); } /* Photo gallery search results – full hydration using gallery template */ if (initials.searchResultsPhotoComponent !== undefined) { let inner = window._pagetualMasterGallery; if (!inner) return; let items = initials.searchResultsPhotoComponent.list; if (!items?.length) return; for (let i = 0; i < eles.length && i < items.length; i++) { let ele = eles[i]; let data = items[i]; let div = document.createElement('div'); div.innerHTML = inner; let coverLink = div.querySelector('a[class*=\"coverLink-\"]'); if (coverLink && data.pageURL) { coverLink.href = data.pageURL; } let img = div.querySelector('img[class*=\"cover-\"]'); if (img) { img.src = data.imageURL; img.srcset = data.thumbURL; img.alt = data.titleLocalized || ''; } let titleLink = div.querySelector('[class*=\"title-\"]'); if (titleLink && data.pageURL) { titleLink.href = data.pageURL; titleLink.textContent = data.titleLocalized || ''; } let authorContainer = div.querySelector('[class*=\"author-\"]'); if (authorContainer && data.author) { authorContainer.href = data.author.link; let nameSpan = authorContainer.querySelector('[class*=\"name-\"]'); if (nameSpan) { nameSpan.textContent = data.author.name; } } let avatarImg = div.querySelector('[class*=\"avatar-\"] img'); if (avatarImg && data.author && data.author.img) { avatarImg.src = data.author.img; avatarImg.alt = data.author.name; } let photoSpan = div.querySelector('[class*=\"caption\"][class*=\"label\"]'); if (photoSpan) photoSpan.textContent = data.imgCount; let viewsSpan = div.querySelector('[class*=\"viewsText-\"]'); if (viewsSpan) viewsSpan.textContent = formatViews(data.views) + ' views'; while (ele.firstChild) ele.removeChild(ele.firstChild); while (div.firstChild) ele.appendChild(div.firstChild); } return; } /* User profile photo gallery – full hydration */ if (initials.contentComponent !== undefined) { let inner = window._pagetualMasterGallery; if (!inner) return; let items = initials.contentComponent.items; if (!items?.length) return; for (let i = 0; i < eles.length && i < items.length; i++) { let ele = eles[i]; let data = items[i]; let div = document.createElement('div'); div.innerHTML = inner; let coverLink = div.querySelector('a[class*=\"coverLink-\"]'); if (coverLink && data.pageURL) { coverLink.href = data.pageURL; } let img = div.querySelector('img[class*=\"cover-\"]'); if (img) { img.src = data.imageURL; img.srcset = data.thumbURL; img.alt = data.titleLocalized || ''; } let titleLink = div.querySelector('[class*=\"title-\"]'); if (titleLink && data.pageURL) { titleLink.href = data.pageURL; titleLink.textContent = data.titleLocalized || ''; } let photoSpan = div.querySelector('[class*=\"caption\"][class*=\"label\"]'); if (photoSpan) photoSpan.textContent = data.imgCount; let viewsSpan = div.querySelector('[class*=\"viewsText-\"]'); if (viewsSpan) viewsSpan.textContent = formatViews(data.views) + ' views'; while (ele.firstChild) ele.removeChild(ele.firstChild); while (div.firstChild) ele.appendChild(div.firstChild); } return; } /* Video pages – full hydration using video template */ let inner = window._pagetualMasterTemplateVideo; if (!inner) return; function findVideoProps(obj, depth) { if (depth > 10) return null; if (!obj || typeof obj !== 'object') return null; if (Array.isArray(obj) && obj.length > 0) { let first = obj[0]; if (first && typeof first === 'object' && 'id' in first && 'duration' in first && 'title' in first && 'pageURL' in first && 'views' in first) { return obj; } } for (let k in obj) if (obj.hasOwnProperty(k)) { let r = findVideoProps(obj[k], depth + 1); if (r) return r; } return null; } let props = findVideoProps(initials, 0); if (!props?.length) return; function formatDuration(s) { let h = Math.floor(s / 3600), m = Math.floor((s % 3600) / 60), sec = s % 60; if (h) return h + ':' + (m < 10 ? '0' + m : m) + ':' + (sec < 10 ? '0' + sec : sec); return m + ':' + (sec < 10 ? '0' + sec : sec); } for (let ele of eles) { let id = ele.getAttribute('data-video-id'); if (!id) continue; let data = props.find(p => p.id == id); if (!data) continue; let div = document.createElement('div'); div.innerHTML = inner; let noscripts = div.querySelectorAll('noscript'); for (let ns of noscripts) ns.remove(); let link = div.querySelector('a[data-role=\"thumb-link\"]'); if (link && data.pageURL) { link.href = data.pageURL; link.setAttribute('data-previewvideo', data.trailerURL || ''); link.setAttribute('aria-label', data.title || ''); } let img = div.querySelector('img.thumb-image-container__image'); if (img) { img.src = data.imageURL; img.srcset = data.thumbURL; img.alt = data.title || ''; } let sprite = div.querySelector('.thumb-image-container__sprite'); if (sprite) { sprite.setAttribute('data-sprite', data.spriteURL || ''); sprite.id = id; } let durationSpan = div.querySelector('[data-role=\"video-duration\"] [class*=\"tiny-\"]'); if (durationSpan) durationSpan.textContent = formatDuration(data.duration); let titleLink = div.querySelector('.video-thumb-info__name'); if (titleLink && data.pageURL) { titleLink.href = data.pageURL; titleLink.title = data.title || ''; titleLink.textContent = data.title || ''; } let uploaderData = div.querySelector('.video-uploader-data'); if (uploaderData) { if (data.landing && data.landing.name) { let logo = uploaderData.querySelector('.video-uploader-logo'); if (logo && data.landing.link) { logo.href = data.landing.link; logo.textContent = data.landing.name.charAt(0).toUpperCase(); } let name = uploaderData.querySelector('.video-uploader__name'); if (name && data.landing.link) { name.href = data.landing.link; name.textContent = data.landing.name; } } else { let logo = uploaderData.querySelector('.video-uploader-logo'); if (logo) logo.remove(); let name = uploaderData.querySelector('.video-uploader__name'); if (name) name.remove(); let sep = uploaderData.querySelector('.video-thumb-uploader__separator'); if (sep) sep.remove(); } } let viewsSpan = div.querySelector('.video-thumb-views'); if (viewsSpan) viewsSpan.textContent = formatViews(data.views) + ' views'; let onVideo = div.querySelector('.thumb-image-container__on-video'); if (onVideo) onVideo.style.zIndex = '20'; if (data.isWatched) { if (onVideo && !onVideo.querySelector('.thumb-image-container__watched')) { let w = document.createElement('div'); w.className = 'thumb-image-container__watched'; w.setAttribute('data-role', 'video-watched'); let tinyBold = 'tiny-bold-' + window._pagetualSuffix; let invert = 'invert-' + window._pagetualSuffix; w.innerHTML = `<div class=\"${tinyBold} ${invert}\">Watched</div>`; if (onVideo.firstChild) onVideo.insertBefore(w, onVideo.firstChild); else onVideo.appendChild(w); } } if (data.hasProducerBadge) { let a = div.querySelector('a[data-role=\"thumb-link\"]'); if (a && !a.querySelector('.thumb-image-container__badge')) { let b = document.createElement('div'); b.className = 'thumb-image-container__badge'; b.setAttribute('data-role-producer-badge', ''); b.setAttribute('data-brand', 'full video'); b.innerHTML = '<span class=\"badge-producer\"></span>'; a.appendChild(b); } } while (ele.firstChild) ele.removeChild(ele.firstChild); while (div.firstChild) ele.appendChild(div.firstChild); }",
"pageAction": "eles.forEach(container => { let anchor = container.querySelector('a[data-role=\"thumb-link\"]'); if (!anchor) return; let trailerUrl = anchor.getAttribute('data-previewvideo'); if (!trailerUrl) return; if (getComputedStyle(anchor).position !== 'relative') anchor.style.position = 'relative'; let videoElem = null; anchor.addEventListener('mouseenter', () => { if (videoElem) return; videoElem = Object.assign(document.createElement('video'), { src: trailerUrl, loop: true, muted: true, autoplay: true, playsInline: true }); Object.assign(videoElem.style, { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', objectFit: 'cover', zIndex: 10, pointerEvents: 'none', backgroundColor: 'black' }); anchor.appendChild(videoElem); videoElem.play(); }); anchor.addEventListener('mouseleave', () => { if (!videoElem) return; videoElem.pause(); videoElem.remove(); videoElem = null; }); }); if (typeof window._pagetualPageCounter === 'undefined') { window._pagetualPageCounter = 1; let pagetualDebug = document.createElement('div'); pagetualDebug.id = 'pagetual-debug'; pagetualDebug.style.cssText = 'position: fixed; bottom: 10px; right: 10px; background: rgba(0,0,0,0.8); color: #0f0; font-family: monospace; font-size: 12px; padding: 3px 4px; border-radius: 5px; z-index: 99999; display: block !important; transform: scale(0.8); transform-origin: bottom right;'; document.body.appendChild(pagetualDebug); } else { window._pagetualPageCounter++; } let debugDiv = document.getElementById('pagetual-debug'); if (debugDiv) debugDiv.textContent = 'P ' + window._pagetualPageCounter; setTimeout(() => { let allThumbs = document.querySelectorAll('.thumb-list__item:not(.loading)'); let hasVisible = Array.from(allThumbs).some(ele => { let style = window.getComputedStyle(ele); return style.display !== 'none' && style.visibility !== 'hidden' && ele.offsetParent !== null; }); if (!hasVisible && !window._pagetualAutoScrollTriggered) { window._pagetualAutoScrollTriggered = true; setTimeout(() => { window.scrollBy(0, 1); setTimeout(() => { window.scrollBy(0, -1); setTimeout(() => { window._pagetualAutoScrollTriggered = false; }, 200); }, 200); }, 50); } }, 500);"
}
]
Loading