Created
May 13, 2026 04:38
-
-
Save sysnucleus/ec477701fef2d64fd93c3a0558d5e35f to your computer and use it in GitHub Desktop.
WebHarvy CMEF Scraping Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| extracting = false; | |
| FIXED = 'data-link-fixed'; | |
| document.addEventListener('click', function (e) { | |
| if (extracting) return; | |
| if (e.target.closest(`a[${FIXED}]`)) { | |
| e.stopPropagation(); | |
| return; | |
| } | |
| card = e.target.closest('.ex-item-wrap'); | |
| if (!card) return; | |
| e.preventDefault(); | |
| e.stopImmediatePropagation(); | |
| extracting = true; | |
| origOpen = window.open; | |
| window.open = function (u) { | |
| url = u; | |
| return { closed: false, focus() {}, close() {} }; | |
| }; | |
| try { card.click(); } finally { | |
| window.open = origOpen; | |
| extracting = false; | |
| } | |
| if (!url) return; | |
| titleEl = e.target.closest('span') || card.querySelector('span'); | |
| if (titleEl && !titleEl.querySelector(`a[${FIXED}]`)) { | |
| a = document.createElement('a'); | |
| a.href = url; | |
| a.target = '_blank'; | |
| a.rel = 'noopener'; | |
| a.textContent = titleEl.textContent; | |
| a.setAttribute(FIXED, ''); | |
| a.style.cssText = 'color:inherit; text-decoration:underline; cursor:pointer;'; | |
| titleEl.innerHTML = ''; | |
| titleEl.appendChild(a); | |
| } | |
| }, true); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment