Skip to content

Commit

Permalink
Version 1.2
Browse files Browse the repository at this point in the history
1.2 - January 2, 2024
- [new] Preferred language setting for DuckDuckGo results in config.php.
- [new] Preferred language setting for Wikipedia results in config.php.
- [new] Combined DuckDuckGo, Google, Wikipedia and Ecosia (Bing) results into one page.
- [new] Ranking algorithm for search results.
- [new] Option to down-rank certain social media sites in results (Makes them show lower down the page).
- [new] Option to show the Goosle rank along with the search source.
- [new] Crawler for results from Limetorrents.lol.
- [new] Periodic check for updates in footer.
- [change] Moved duckduckgo.php and google.php into the engines/search/ folder.
- [change] Removed Wikipedia special search in favor of actual search results.
- [change] Removed 'Date Added' from 1337x results.
- [change] Removed Chrome based and Mobile user-agents, as they don't work for the WikiPedia API.
- [change] Added more trackers for generating magnet links.
- [tweak] 30-50% faster parsing of search results (couple of ms per search query).
- [tweak] Expanded the season/episode filter to all sources that support TV Shows.
- [tweak] More sensible santization of variables (Searching for html tags/basic code should now work).
- [tweak] Moved 'imdb_id_search' out from special results into its 'own' setting.
- [tweak] Moved 'password_generator' out from special results into its 'own' setting.
- [tweak] More accurate and faster Google scrape.
- [tweak] Reduced paragraph margins.
- [tweak] More code cleanup, making it more uniform.
- [fix] Prevents searching on disabled methods by 'cheating' the search type in the url.
- [fix] Better decoding for special characters in urls for search results.
- [fix] Better validation for special searches trigger words.
- [fix] Better sanitization for DuckDuckGo and Google results.
  • Loading branch information
Arnan de Gans committed Jan 2, 2024
1 parent 86d0d57 commit 92a70e6
Show file tree
Hide file tree
Showing 24 changed files with 1,244 additions and 556 deletions.
13 changes: 9 additions & 4 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ body { position: relative; margin: 0; padding: 0; font-family: Arial, Helvetica,
div { margin: 0; padding: 0; border: 0; font-size: 100%; vertical-align: baseline; }
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block; }
h2, h3, h4, h5, h6 { font-weight: normal; }
h2, h3, h4, h5, h6, p, ul, ol, blockquote { padding-top: .5em; padding-bottom: .5em; }
h2, h3, h4, h5, h6, p, ul, ol, blockquote { margin: 0; padding-top: .5em; padding-bottom: .5em; }
ol, ol > li { margin: 0; padding: 0; list-style: none; }
input, button { outline: none; }
button { cursor: pointer; }
Expand Down Expand Up @@ -60,19 +60,23 @@ body.main { background-color: #1f242b; color: #f0f6fc; }

/* Search results - Main column */
.main-column { width: 100%; }
.main-column ol .meta { margin: .75rem 0 .05rem 0; padding: .5rem 10px 0 10px; }
.main-column ol .sources { margin: .05rem 0 .75rem 0; padding: 0 10px .5rem 10px; font-size: 12px; color: #666; }

.main-column ol .special-result { margin: .75rem 0 .25rem 0; padding: .5rem 10px; }
.main-column ol .result { margin: .50rem 0 .50rem 0; padding: 0; }
.main-column ol .special-result, .main-column ol .meta { margin: .75rem 0 .75rem 0; padding: .5rem 10px; }

.main-column ol li article { padding: .5rem 10px; border: 1px solid #fefefe; border-radius: 8px; }
.main-column ol li article div.url:first-child, .main-column ol li.special-result article div.source:first-child { flex-grow: 0; }
.main-column ol li article div.url { display: inline-block; margin: 0; max-width: 100%; color: #666; font-size: 1rem; line-height: 1.6; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-column ol li article div.url a { margin: 0; color: #3f6e35; cursor: pointer; text-decoration: none; }
.main-column ol li article div.title, .main-column ol li.special-result article div.title { margin-top: .146rem; margin-bottom: .28451rem; }
.main-column ol li article div.title, .main-column ol li.special-result article div.title { margin-bottom: .29rem; }
.main-column ol li article div.title h2 { margin: 0; padding: 0; position: relative; font-size: 1.46rem; letter-spacing: -.01px; }
.main-column ol li article div.title h2:hover { text-decoration: underline; }
.main-column ol li article div.title a { margin: 0; display: block; cursor: pointer; }
.main-column ol li article div.title a:visited { color: #6d59a3; }
.main-column ol li article div.description { margin: 0; line-height: 1.4; font-size: 1rem; color: #494949; }
.main-column ol li article div.engine { padding: 2px 0; font: 12px italic; color: #666; }
.main-column ol li article div.description .seeders { color: #518257; }
.main-column ol li article div.description .leechers { color: #c00; }

Expand All @@ -99,7 +103,7 @@ body.main { background-color: #1f242b; color: #f0f6fc; }
.main-column ol li.special-result article div.title h2:hover { text-decoration: none; }
.main-column ol li.special-result article div.title a { margin: 0; display: block; color: #6c00a2; cursor: pointer; }
.main-column ol li.special-result article div.title a:visited { color: #6d59a3; }
.main-column ol li.special-result article div.text, .main-column ol li article div.source { padding-top: 10px; position: relative; font-style: normal; }
.main-column ol li.special-result article div.text, .main-column ol li article div.source { position: relative; font-style: normal; }
.main-column ol li.special-result article div.text img { padding: 0 0 10px 10px; }
.main-column ol li.special-result article div.source { display: inline-block; margin: 0; max-width: 100%; color: #666; font-size: 1rem; line-height: 1.6; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: inherit; }
.main-column ol li.special-result article div.source a { margin: 0; color: #3f6e35; text-decoration: none; }
Expand All @@ -118,6 +122,7 @@ body.main { background-color: #1f242b; color: #f0f6fc; }
.footer-wrap { background-color: #161616; color: #f0f6fc; border-top: 2px solid #303134; }
.footer { padding: 10px; }
.footer a { color: #f0f6fc; }
a.update { color: #c90; font-weight: bold; }

@media only screen and (max-width:960px) { /* tablet, landscape iPad, lo-res laptops ands desktops */
/* Page structure */
Expand Down
95 changes: 72 additions & 23 deletions config.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,30 @@
Disclaimer: This is not meant to 'hack proof' or truly secure the setup. Just a simple token to keep surface level prying eyes out.
CACHE:
If you have ACPu it is highly recommended to enable caching as it'll speed up repeatable searched by a lot.
If you have ACPu enabled in your server it is highly recommended to enable caching as it'll speed up repeat searches by a lot.
"on" (Recommended) for active sites, requires APCu
"off" Disables cache, useful for testing or if your server lacks APCu support
CACHE_TIME:
Minutes the result should be cached in ACPu.
Accepts a numeric value between 1 and 30.
LANGUAGE:
DuckDuckGo, Google and Ecosia are language agnostic. But they DO profile you for your locale.
For example: Me searching with english terms has me seeing Spanish results because I live in Mexico. This setting should minimize that for supported engines.
DuckDuckGo uses language regions as opposed to a simpler language choice. See if your region is available - https://duckduckgo.com/duckduckgo-help-pages/settings/params/.
Google's language option breaks reasonable results and other options like verbatim mode and some other settings. So you'll have to rely on Google picking up on the query language.
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.)
SOCIAL MEDIA RELEVANCE:
Show social media results lower in the combined results if you don't value such results.
Downranked results include: Facebook, Instagram, Twitter, Snapchat, TikTok, LinkedIn and Reddit.
!!CAREFUL!! This is a blanket setting, if what 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)
ENABLE IMAGE SEARCH:
Enable or disable image searches - Search results are provided by Qwant.
Enable or disable image searches - Search results are provided by Yahoo! Images.
"on" (Default)
"off"
Expand All @@ -40,6 +55,27 @@
"on" (Default)
"off"
SHOW SEARCH SOURCE:
Show which search engine(s) came up with the result.
"on" (Default)
"off"
SHOW SEARCH RANK:
When search source is enabled, show the rank Goosle gave the result.
"on"
"off" (Default)
IMDB ID SEARCH:
Highlight imdb results if it's a tv-show.
Handy for finding better results for specific tv-shows through EZTV and The Pirate Bay.
"on"
"off" (Default)
PASSWORD GENERATOR
Show a password generator on the Goosle home page.
"on" (Default)
"off"
SPECIAL:
Enable or disable special searches that show up before search results.
"on" (Default)
Expand All @@ -48,58 +84,68 @@
USER AGENTS:
Add more or less user agents to the list. Keep at least one.
On every search Goosle picks one at random to identify as.
Keep them generic to prevent profiling, but also so that the request comes off as a generic boring browser and not a server/script.
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.
Safari and Internet Explorer may be a limiting factor on results as they are lesser supported browsers. But should otherwise be fine.
Chrome may attract attention because of the lack of Chrome information (tracking) aside from the user agent.
Safari, Firefox and Internet Explorer/Edge should be safe to use.
Chrome may attract attention because of the lack of Chrome information (tracking) aside from the user agent. The search engine will know something is wrong.
Opera/Edge/Brave and many others use Chrome under the hood and are not a good pick for that reason.
Mobile agents may work, but some services like Wikipedia are a bit picky when it comes to answering API calls. Mobile users generally do not use APIs, so they may block your search.
SHOW ZERO SEEDERS:
Set to "on" to include results with 0 seeders (slow or stale downloads). Off to exclude these results.
"on" (Default)
"off"
BLOCK 1337x CATEGORIES:
Add category IDs of 1337x categories, check /engines/torrent/1337x.php for a list of known categories.
Accepts a basic numeric array, comma separated.
BLOCK PIRATEBAY CATEGORIES:
Add category IDs of Pirate Bay categories, check /engines/torrent/thepiratebay.php for a list of known categories.
Accepts a basic numeric array, comma separated.
BLOCK YTS CATEGORIES:
Add category names as keywords, eg; "thriller", "war".
Movies can be in multiple categories, if a movie is in 5 categories it only has to match one to be filtered out.
Accepts a basic array of keywords, comma separated.
TORRENT TRACKERS:
Only used for The Pirate Bay and YTS.
These are added to the magnet links Goosle creates. You can add more or replace the existing ones.
Only used for The Pirate Bay, LimeTorrents and YTS.
Generally you do not need to change these.
These are added to the magnet links Goosle creates. You can add more or replace the existing ones if you know what you're doing.
Accepts a basic array of strings (tracker urls), comma separated.
------------------------------------------------------------------------------------ */

return (object) array(
"hash" => "j9fg-i2du-er6m",
"hash_auth" => "off", // Default: off
"cache" => "off", // Default: off
"cache_time" => 30, // Default: 30
"cache_time" => 30, // Default: 30 (Minutes)

"duckduckgo_language" => "uk-en", // Default: uk-en (United Kingdom)
"wikipedia_language" => "en", // Default: en (English)

"social_media_relevance" => 8, // Default: 8

"enable_image_search" => "on", // Default: on
"enable_torrent_search" => "on", // Default: on

"show_search_source" => "on", // Default: on
"show_search_rank" => "off", // Default: off
"imdb_id_search" => "off", // Default: off
"password_generator" => "on", // Default: on

"special" => array(
"currency" => "on", // Currency converter
"definition" => "on", // Word dictionary
"wikipedia" => "on", // Wikipedia highlight
"phpnet" => "on", // PHP-dot-net highlight
"imdb_id_search" => "on", // Highlight IMDB IDs for tv shows, to use for torrent searches
"password_generator" => "on" // Password generator on homepage
"currency" => "on", // Default: on, Currency converter
"definition" => "on", // Default: on, Word dictionary
"phpnet" => "off" // Default: off, PHP-dot-net highlight
),

"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
"Mozilla/5.0 (Linux; Android 5.0.2; AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.3 Chrome/38.0.2125.102 Safari/537.36", // Android 5, Samsungbrowser 3
"Mozilla/5.0 (Linux; Android 7.0; AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.116 Safari/537.36", // Android 7, Chrome 60
"Mozilla/5.0 (Linux; U; Android 4.2.2; he-il; AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", // Android 4. Some webkit browser (Chrome?)
"Mozilla/5.0 (iPhone12,1; U; CPU iPhone OS 13_0 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/15E148 Safari/602.1", // iOS 13, Safari
"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/13.2b11866 Mobile/16A366 Safari/605.1.15", // iOS 12, Firefox 13
),

"show_zero_seeders" => "on", // Default: on
Expand All @@ -108,12 +154,15 @@
"yts_categories_blocked" => array("horror"), // Default: "horror"
"torrent_trackers" => array(
"http://nyaa.tracker.wf:7777/announce",
"udp://open.stealth.si:80/announce",
"http://tracker.openbittorrent.com:80/announce",
"udp://tracker.opentrackr.org:1337/announce",
"udp://exodus.desync.com:6969/announce",
"udp://tracker.torrent.eu.org:451/announce",
),

"version" => "1.1b2" // Please don't change this
"udp://tracker.yify-torrents.com/announce",
"udp://coppersurfer.tk:6969/announce",
"udp://opentracker.i2p.rocks:6969/announce",
"udp://tracker.internetwarriors.net:1337/announce",
"udp://tracker.zer0day.to:1337/announce",
)
);
?>
115 changes: 115 additions & 0 deletions engines/image/yahoo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php
/* ------------------------------------------------------------------------------------
* Goosle - A meta search engine for private and fast internet fun.
*
* 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.
------------------------------------------------------------------------------------ */
class YahooImageRequest extends EngineRequest {
public function get_request_url() {
// Split the query
$query_terms = explode(" ", strtolower($this->query));

// Size override
$size = "";
if($query_terms[0] == 'size') {
$switch = explode(":", $query_terms[0]);

if((strlen($switch[1]) >= 3 && strlen($switch[1]) <= 6) && !is_numeric($switch[1])) {
if($switch[1] == "med") $switch[1] = "medium";
if($switch[1] == "lrg") $switch[1] = "large";
if($switch[1] == "xlrg") $switch[1] = "wallpaper";

if($switch[1] == "small" || $switch[1] == "medium" || $switch[1] == "large" || $switch[1] == "wallpaper") {
$size = $switch[1];
}

$this->query = implode(" ", array_slice($query_terms, 1));
}
}

// p = query
// imgsz = Image size (small|medium|large|wallpaper)

$args = array("p" => $this->query, "imgsz" => $size);
$url = "https://images.search.yahoo.com/search/images?".http_build_query($args);

unset($query_terms, $switch, $args, $size);

return $url;
}

public function parse_results($response) {
$results = array();
$xpath = get_xpath($response);

if(!$xpath) return array();

// Scrape recommended
$didyoumean = $xpath->query(".//section[@class='dym-c']/section/h3/a")[0];
if(!is_null($didyoumean)) {
$results['did_you_mean'] = $didyoumean->textContent;
}
$search_specific = $xpath->query(".//section[@class='dym-c']/section/h5/a")[0];
if(!is_null($search_specific)) {
$results['search_specific'] = $search_specific->textContent;
}

// Scrape the results
$scrape = $xpath->query("//li[contains(@class, 'ld') and not(contains(@class, 'slotting'))][position() < 101]");
$rank = $results['amount'] = count($scrape);
foreach($scrape as $result) {
$image = $xpath->evaluate(".//img/@src", $result)[0];
if($image == null) continue;

$url_data = $xpath->evaluate(".//a/@href", $result)[0];
if($url_data == null) continue;

// Get meta data
// -- Relevant $url_data (there is more, but unused by Goosle)
// w = Image width (1280)
// h = Image height (720)
// imgurl = Actual full size image (Used in Yahoo preview/popup)
// rurl = Url to page where the image is used
// size = Image size (413.1KB)
// tt = Website title (Used for image alt text)
parse_str($url_data->textContent, $url_data);

// Deal with optional or missing data
$dimensions_w = (!array_key_exists('w', $url_data) || empty($url_data['w'])) ? "" : htmlspecialchars($url_data['w']);
$dimensions_h = (!array_key_exists('h', $url_data) || empty($url_data['h'])) ? "" : htmlspecialchars($url_data['h']);
$filesize = (!array_key_exists('size', $url_data) || empty($url_data['size'])) ? "" : htmlspecialchars($url_data['size']);
$link = (!array_key_exists('imgurl', $url_data) || empty($url_data['imgurl'])) ? "" : "//".htmlspecialchars($url_data['imgurl']);

// Process result
$image = htmlspecialchars($image->textContent);
$url = htmlspecialchars($url_data['rurl']);
$alt = htmlspecialchars($url_data['tt']);

// filter duplicate urls/results
if(!empty($results['search'])) {
$result_urls = array_column($results['search'], "direct_link");
if(in_array($link, $result_urls)) continue;
}

$id = uniqid(rand(0, 9999));

$results['search'][] = array ("id" => $id, "source" => "Yahoo! Images", "image" => $image, "alt" => $alt, "url" => $url, "width" => $dimensions_w, "height" => $dimensions_h, "filesize" => $filesize, "direct_link" => $link, "engine_rank" => $rank);
$rank -= 1;
}

// Add error if there are no search results
if(empty($results['search'])) {
$results['error'] = array(
"message" => "No results found. Please try with less or different keywords!"
);
}

return $results;
}
}
?>
Loading

0 comments on commit 92a70e6

Please sign in to comment.