Google Searcg
by RFour · Aug 8, 2026 ·javascript
Google search stuff, ykk, search uhh stuff
JsonSearchLazyJs
| 1 | const axios = require('axios'); |
| 2 | |
| 3 | async function googlesearch({ q, page = 1, lang = 'en', safe = 'off' } = {}) { |
| 4 | const res = await axios.get('http://goosh.org/q.php', { |
| 5 | headers: { referer: 'https://goosh.org/', 'user-agent': 'Mozilla/5.0 (Linux; Android 15) AppleWebKit/537.36 Chrome/130.0.0.0 Mobile Safari/537.36' }, |
| 6 | params: { q, start: page, hl: lang, safe, rsz: 'large' } |
| 7 | }); |
| 8 | const clean = res.data.trim().replace(/^\(,/, '').replace(/\);$/, ''); |
| 9 | const data = JSON.parse(clean); |
| 10 | return { |
| 11 | totalResults: data.searchInformation?.totalResults || '0', |
| 12 | searchTime: data.searchInformation?.searchTime || 0, |
| 13 | items: (data?.items || []).map((item, i) => ({ |
| 14 | no: i + 1, |
| 15 | title: item.title, |
| 16 | snippet: item.snippet, |
| 17 | domain: item.displayLink, |
| 18 | url: item.link, |
| 19 | icon: item.displayLink ? `https://www.google.com/s2/favicons?domain=${item.displayLink}&sz=64` : null, |
| 20 | description: item.pagemap?.metatags?.[0]?.['og:description'] || null, |
| 21 | image: item.pagemap?.cse_image?.[0]?.src || null |
| 22 | })) |
| 23 | }; |
| 24 | } |
| 25 | |
| 26 | /* |
| 27 | googlesearch({ q: 'wearedevs.lol' }).then(r => console.log(JSON.stringify(r, null, 2))).catch(e => console.error(e.message)); |
| 28 | googlesearch({ q: 'Netanyahu', lang: 'id', safe: 'on' }).then(r => console.log(JSON.stringify(r, null, 2))).catch(e => console.error(e.message)); |
| 29 | googlesearch({ q: 'six seven', page: 2 }).then(r => console.log(JSON.stringify(r, null, 2))).catch(e => console.error(e.message)); |
| 30 | googlesearch({ q: 'javascript', lang: 'en', safe: 'off' }).then(r => console.log(JSON.stringify(r, null, 2))).catch(e => console.error(e.message)); |
| 31 | *\ |