2023-12-05 22:11:28 +00:00
< ? php
/* ------------------------------------------------------------------------------------
2024-06-20 00:08:00 +00:00
* Goosle - The fast , privacy oriented search tool that just works .
2023-12-05 22:11:28 +00:00
*
* COPYRIGHT NOTICE
* Copyright 2023 - 2024 Arnan de Gans . All Rights Reserved .
*
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT .
* By using this code you agree to indemnify Arnan de Gans from any
* liability that might arise from its use .
------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------
2024-05-17 01:12:14 +00:00
SITEURL :
Set the base domain name for your Goosle setup ( ex . example . com , something . example . com , example . com / something / ) so that internal links will work correctly .
2024-06-20 00:08:00 +00:00
COLORSCHEME :
Set a default colorscheme .
'default' A dark headers and main backgrounds with light search results .
'light' More light elements .
'dark' More dark elements , some apps would call this dark mode .
'auto' Let the browser decide what to use , uses dark . css for Darkmode . default . css for regular viewing .
For advanced users : You can create your own colorschemes this way too .
2024-07-15 20:11:08 +00:00
Duplicate the file / assets / css / default . css and name it something like 'mycolorscheme.css' .
Edit the color variables to your liking .
To use the colorscheme , use the filename without extension in this setting .
2024-06-20 00:08:00 +00:00
2023-12-05 22:11:28 +00:00
HASH :
2024-07-15 20:11:08 +00:00
A simple lowercase passphrase , something simple like : goose1234 or 1846.
Used for caching search results and optionally for accessing Goosle ( See HASH_AUTH option ) .
2023-12-05 22:11:28 +00:00
2024-05-17 01:12:14 +00:00
HASH_AUTH :
2024-07-15 20:11:08 +00:00
Use the HASH option as a simple passphrase .
2024-06-20 00:08:00 +00:00
Using a passphrase lets you host Goosle on a public facing server without providing a public service .
2024-05-17 01:12:14 +00:00
This is useful for if just you and some friends or family should be able to use Goosle from anywhere .
2024-06-20 00:08:00 +00:00
'off' Don ' t use the hash as a password .
'on' Use the hash as a password .
2023-12-21 10:02:42 +00:00
2024-07-15 20:11:08 +00:00
Usage : https :// example . com / ? a = goose1234
2024-05-17 01:12:14 +00:00
Disclaimer : This is not meant to 'hack proof' or truly secure the setup . Just a simple token to keep surface level prying eyes out .
2024-02-16 20:56:04 +00:00
CACHE_TYPE :
2024-05-17 01:12:14 +00:00
It is highly recommended to enable caching as it will speed up repeat searches by a lot .
The cache is NOT unique per user but shared between all users . Different users searching for the exact same thing get the same results .
2024-07-15 20:11:08 +00:00
Results loaded from the cache are much much faster to load .
2024-05-17 01:12:14 +00:00
Caching can be done in memory with APCu or as temporary files in the / cache / folder .
2024-07-15 20:11:08 +00:00
Enabling caching also enables pagination for search results .
2024-05-17 01:12:14 +00:00
2024-06-20 00:08:00 +00:00
'off' No caching .
'file' Store results in text files ( Default ) .
2024-07-15 20:11:08 +00:00
'apcu' Faster , requires more memory .
2023-12-05 22:11:28 +00:00
CACHE_TIME :
2024-07-15 20:11:08 +00:00
APCu stores in memory , using a longer cache time takes up more of it . It is recommended to not exceed a few ( 1 or 2 ? ) hours for APCu .
2024-01-15 18:31:22 +00:00
The file cache is only limited by your hosting storage space and can safely be much much longer if you want .
2024-06-20 00:08:00 +00:00
To not show outdated results the 'limit' is 48 hours .
2024-05-17 01:12:14 +00:00
Ignored if above 'CACHE_TYPE' option is set to off .
2024-07-19 21:57:40 +00:00
QUERYLOG :
The query log is useful if you make common requests and for some reason one engine returns no result and no error . Enabling the querylog lets you see if a request was made and how many results were found / scraped / retrieved . But also how many are left after initial processing .
The querylog logs requests per day into a file in / cache /. This function is not meant to be on for production use . Only for debugging or understanding results .
Example : [ 18 - 07 - 2024 22 : 15 : 05 ][ s ] GoogleRequest : 30 -> 4 , https :// www . google . com / search ? q = the + wild + goose + chase & safe = 1 & num = 30 & pws = 0 & udm = 14 & tbs = li % 3 A1 & complete = 0 & sclient = web
Here a query is made to Google web search , Goosle scraped 30 results but after initial filtering only 4 remained . This can mean a lot of duplicate links were found ( unlikely ) . More likely is that an inconsistent scrape was done . This can indicate that the website has changed its layout structure and Goosle needs to be updated .
Example : [ 18 - 07 - 2024 23 : 06 : 58 ][ a ] QwantRequest : No results -> 0 , https :// api . qwant . com / v3 / search / web ? q = the + wild + goose + chase & t = web & safesearch = 1 & locale = en_gb & count = 10 & device = desktop
Here a query is made to Qwant web search via their API and no results were found at all . API calls can not make scrape errors . This likely means there simply were no results to begin with .
2024-05-17 01:12:14 +00:00
/* ------------------------------------------------------------------------------------
2024-01-02 06:24:27 +00:00
LANGUAGE :
2024-05-17 01:12:14 +00:00
To not fit the USA mold , Goosle defaults to the United Kingdom for english results .
2024-07-15 20:11:08 +00:00
DuckDuckGo and Google are language agnostic .
Invalid values either cause the search engine to fail or will default to English depending on how wrong the value is .
2024-05-17 01:12:14 +00:00
Google has no language setting because as soon as you specify it all 'anonymous' settings stop working .
2024-07-19 21:57:40 +00:00
2024-05-17 01:12:14 +00:00
DuckDuckGo uses language regions and defaults to the United Kingdom . To change it see if your region is available - https :// duckduckgo . com / duckduckgo - help - pages / settings / params /.
2024-07-19 21:57:40 +00:00
2024-01-02 06:24:27 +00:00
Wikipedia needs to be told which language you want . This changes the search url . Use any of their supported languages ( en , es , fr , nl , etc . )
2024-06-20 00:08:00 +00:00
Qwant uses a locale similar to DuckDuckGo and defaults to the United Kingdom as well .
Available locales are : bg_bg , br_fr , ca_ad , ca_es , ca_fr , co_fr , cs_cz , cy_gb , da_dk , de_at , de_ch , de_de , ec_ca , el_gr , en_au , en_ca , en_gb , en_ie , en_my , en_nz , en_us , es_ad , es_ar , es_cl , es_co , es_es , es_mx , es_pe , et_ee , eu_es , eu_fr , fc_ca , fi_fi , fr_ad , fr_be , fr_ca , fr_ch , fr_fr , gd_gb , he_il , hu_hu , it_ch , it_it , ko_kr , nb_no , nl_be , nl_nl , pl_pl , pt_ad , pt_pt , ro_ro , sv_se , th_th , zh_cn , zh_hk .
2024-01-02 06:24:27 +00:00
SOCIAL MEDIA RELEVANCE :
2024-07-15 20:11:08 +00:00
Show social media results lower in results if you don ' t value such results .
This includes websites like Facebook , Instagram , Twitter / X , Snapchat , TikTok , LinkedIn and Reddit .
2024-05-17 01:12:14 +00:00
!! CAREFUL !! This is a blanket setting , if what ( or who ) you ' re searching for primarily has social media links then less relevant results may show first .
Accepts a numeric value between 1 and 10. With 10 having * NO * effect on the rank , and 0 not ranking the link at all ( shows very very low in the results ) .
/* ------------------------------------------------------------------------------------
2024-02-16 20:56:04 +00:00
USER AGENTS :
2024-05-17 01:12:14 +00:00
Add more or less user agents to the list but keep at least one !
2024-07-15 20:11:08 +00:00
On every search Goosle picks a user agent at random to identify as .
2024-02-16 20:56:04 +00:00
Keep them generic to prevent profiling , but also so that the request comes off as a generic boring browser and not as a server / crawler .
2024-05-17 01:12:14 +00:00
Safari , Firefox and Internet Explorer ( Yes that ' s old ! ) should be safe to use .
2024-02-16 20:56:04 +00:00
Chrome may attract attention because of the lack of Chrome information ( tracking ) aside from the user agent . The search engine may know something is 'weird' .
Opera / Edge / Brave and many others use Chrome under the hood and are not a good pick for that reason .
2024-07-15 20:11:08 +00:00
Do not use user agents for mobile devices . Where possible Goosle explicitly tells the service it ' s a desktop computer to get a certain format for results .
Contradicting the request with a mobile user agent may get your banned .
2024-02-16 20:56:04 +00:00
2024-04-12 01:46:30 +00:00
MAGNET TRACKERS :
2024-07-15 20:11:08 +00:00
Add more or less magnet trackers to the list but keep at least five or so !
2024-05-17 01:12:14 +00:00
These are added to the magnet links Goosle creates by itself .
2024-01-02 06:24:27 +00:00
Generally you do not need to change these .
2023-12-05 22:11:28 +00:00
------------------------------------------------------------------------------------ */
return ( object ) array (
2024-07-15 20:11:08 +00:00
'siteurl' => 'example.com' , // Make sure this is accurate (ex. example.com, goosle.example.com, example.com/goosle/)
2024-06-20 00:08:00 +00:00
'colorscheme' => 'default' , // Default colorscheme to use
2024-07-15 20:11:08 +00:00
'hash' => '123456' , // Some kind of alphanumeric password-like string, used for caching and optionally for access to Goosle
2024-06-20 00:08:00 +00:00
'hash_auth' => 'off' , // Default: off
'cache_type' => 'file' , // Default: file
2024-07-15 20:11:08 +00:00
'cache_time' => 8 , // Default: 8 (Hours), see the recommendations above.
'timezone' => 'UTC' , // Default: UTC (Enter UTC+1, UTC-6 etc. for your timezone - Find yours https://time.is/UTC)
2024-07-19 21:57:40 +00:00
'querylog' => 'off' , // Default: off (Log remote queries to see if they are made and how much results they find and end up with)
2024-06-20 00:08:00 +00:00
'enable_duckduckgo' => 'on' , // Default: on
'enable_google' => 'on' , // Default: on
'enable_qwant' => 'on' , // Default: on
'enable_brave' => 'on' , // Default: on
'enable_wikipedia' => 'on' , // Default: on
2024-07-15 20:11:08 +00:00
'enable_news_search' => 'on' , // Default: on (Disables all news search regardless of settings for individual engines)
2024-06-20 00:08:00 +00:00
'enable_qwantnews' => 'on' , // Default: on
'enable_yahoonews' => 'on' , // Default: on
'enable_bravenews' => 'on' , // Default: on
'enable_hackernews' => 'on' , // Default: on
'enable_image_search' => 'on' , // Default: on (Disables all image search regardless of settings for individual engines)
'enable_yahooimages' => 'on' , // Default: on
2024-07-15 20:11:08 +00:00
'enable_openverse' => 'off' , // Default: off (Requires API token, see readme.md for details)
2024-06-20 00:08:00 +00:00
'enable_qwantimages' => 'on' , // Default: on
'enable_magnet_search' => 'on' , // Default: on (Disables all magnet search regardless of settings for individual engines as well as the box office page)
'enable_eztv' => 'on' , // Default: on
'enable_limetorrents' => 'on' , // Default: on
'enable_nyaa' => 'on' , // Default: on
'enable_sukebei' => 'on' , // Default: on
'enable_piratebay' => 'on' , // Default: on
'enable_yts' => 'on' , // Default: on
'duckduckgo_language' => 'uk-en' , // Default: uk-en (United Kingdom)
'wikipedia_language' => 'en' , // Default: en (English)
'qwant_language' => 'en_gb' , // Default: en_gb (United Kingdom)
2024-07-15 20:11:08 +00:00
'search_results_per_page' => 24 , // Default: 24 (Any number between 8 and 160, preferably a multiple of 8. Ignored if caching is off)
2024-06-20 00:08:00 +00:00
'social_media_relevance' => 8 , // Default: 8
'show_search_source' => 'on' , // Default: on
2024-07-15 20:11:08 +00:00
'show_search_rank' => 'off' , // Default: off (Mostly for debugging)
'imdb_id_search' => 'off' , // Default: off, (Requires enable_magnet_search to also be on)
2024-06-20 00:08:00 +00:00
'password_generator' => 'on' , // Default: on
'special' => array (
'currency' => 'on' , // Default: on, Currency converter
'definition' => 'on' , // Default: on, Word dictionary
'ipaddress' => 'on' , // Default: on, Look up your IP Address
2024-07-15 20:11:08 +00:00
'phpnet' => 'on' , // Default: on, PHP-dot-net functions highlight
'wordpress' => 'off' // Default: off, Wordpress functions highlight
2023-12-05 22:11:28 +00:00
),
2024-07-15 20:11:08 +00:00
'show_nsfw_magnets' => 'off' , // Default: off (Set to 'off' to try and hide adult content. Override with 'safe:off', 'xxx' or 'porn')
2024-06-20 00:08:00 +00:00
'show_zero_seeders' => 'off' , // Default: off
'show_yts_highlight' => 'on' , // Default: off (Show latest YTS movies above Magnet search results)
'show_share_option' => 'on' , // Default: on (Show a share option for Magnet results)
'piratebay_categories_blocked' => array ( 206 , 210 ), // Default: 206, 210 (Comma separated numbers, see /engines/magnet/thepiratebay.php for all categories)
2024-07-15 20:11:08 +00:00
'yts_categories_blocked' => array ( 'horror' ), // Default: 'horror' (Comma separated keywords; array('action', 'drama', 'sci-fi') etc.. There is no defined list, so block keywords that you see on results and don't like)
2024-06-20 00:08:00 +00:00
2024-07-15 20:11:08 +00:00
// Keep at-least 1
2024-06-20 00:08:00 +00:00
'user_agents' => array (
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15) Gecko/20100101 Firefox/119.0' , // macOS 10.15, Firefox 119
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Gecko/20100101 Firefox/116.0' , // Windows 10, Firefox 116
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64) Gecko/20100101 Firefox/83.0' , // Linux Ubuntu, Firefox 83
'Mozilla/5.0 (X11; Linux i686) Gecko/20100101 Firefox/119.0' , // Linux Generic, Firefox 119
2023-12-05 22:11:28 +00:00
),
2024-07-15 20:11:08 +00:00
// Keep at-least 5
2024-06-20 00:08:00 +00:00
'magnet_trackers' => array (
2024-07-15 20:11:08 +00:00
'udp://tracker.coppersurfer.tk:6969' ,
'udp://tracker.leechers-paradise.org:6969' ,
'udp://p4p.arenabg.ch:1337' ,
'udp://tracker.internetwarriors.net:1337' ,
'udp://glotorrents.pw:6969/announce' ,
'udp://torrent.gresille.org:80/announce' ,
'udp://tracker.openbittorrent.com:80' ,
2024-06-20 00:08:00 +00:00
'http://nyaa.tracker.wf:7777/announce' ,
'udp://tracker.opentrackr.org:1337/announce' ,
'udp://exodus.desync.com:6969/announce' ,
'udp://tracker.torrent.eu.org:451/announce' ,
'udp://opentracker.i2p.rocks:6969/announce' ,
'udp://open.demonii.com:1337/announce' ,
'udp://open.stealth.si:80/announce' ,
'udp://tracker.moeking.me:6969/announce' ,
'udp://explodie.org:6969/announce' ,
'udp://tracker1.bt.moack.co.kr:80/announce' ,
'udp://tracker.theoks.net:6969/announce' ,
'udp://tracker-udp.gbitt.info:80/announce' ,
'https://tracker.tamersunion.org:443/announce' ,
'https://tracker.gbitt.info:443/announce' ,
'udp://tracker.tiny-vps.com:6969/announce' ,
'udp://tracker.dump.cl:6969/announce' ,
'udp://tamas3.ynh.fr:6969/announce' ,
'udp://retracker01-msk-virt.corbina.net:80/announce' ,
'udp://open.free-tracker.ga:6969/announce' ,
'udp://epider.me:6969/announce' ,
'udp://bt2.archive.org:6969/announce' ,
2024-01-02 06:24:27 +00:00
)
2023-12-05 22:11:28 +00:00
);
2024-05-17 01:12:14 +00:00
?>