diff --git a/gimme_job/adapters/googlejobs.py b/gimme_job/adapters/googlejobs.py index 0b97023..0c4c564 100644 --- a/gimme_job/adapters/googlejobs.py +++ b/gimme_job/adapters/googlejobs.py @@ -17,14 +17,20 @@ _EXTRACT_JS = """() => { const shareEl = card.closest('[data-share-url]'); const shareUrl = shareEl ? shareEl.getAttribute('data-share-url') : ''; - // Use shareUrl directly — it contains the full fragment (#fpstate=tldetail&htidocid=...) - // needed to open the job detail panel in Google Jobs. - let jobUrl = shareUrl; + // Build a clean udm=8 deep-link that opens the job detail panel. + // The shareUrl has session-tied tokens (shmd, shmds, shem) that can expire; + // we strip them and use only the htidocid + the new SPA fragment format. + let jobUrl = ''; let htidocid = ''; if (shareUrl) { const docMatch = shareUrl.match(/htidocid=([^&]+)/); + const qMatch = shareUrl.match(/[?&]q=([^&#]+)/); if (docMatch) { htidocid = decodeURIComponent(docMatch[1]); + const q = qMatch ? qMatch[1] : 'orthodontist+job'; + jobUrl = 'https://www.google.com/search?q=' + q + '&udm=8' + + '#vhid=vt%3D20/docid%3D' + docMatch[1] + + '&vssid=jobs-detail-viewer'; } }