Skip to content

Commit

Permalink
Version 1.1
Browse files Browse the repository at this point in the history
A quality of life update - Mostly.

1.1 - December 21, 2023
- [new] API search for EZTV TV Shows.
- [new] config.default.php with default settings.
- [new] New option 'imdb_id_search' in 'special' settings in config.php.
- [new] New option 'show_zero_seeders' in config.php.
- [new] Special result and torrent redirect for IMDb IDs.
- [new] Replaced image search with Yahoo! Images.
- [new] Styled 'reset' button for search fields.
- [tweak] Removed 'raw_output' option.
- [tweak] Re-arranged results array to be more logical/easy to use.
- [tweak] Re-arranged code for results to do no double checks for search results.
- [tweak] Added more user-agents.
- [tweak] Torrent results page.
- [tweak] Sanitize scraped data earlier in the process.
- [tweak] Consistent single quotes for arrays.
- [tweak] Consistent spaces, tabs and newlines.
- [fix] Inconsistent input height for search field vs search button.
- [fix] Better check if a search is currency conversion or not.
- [fix] Typos in help.php.
  • Loading branch information
Arnan de Gans committed Dec 21, 2023
1 parent 0340ccb commit 86d0d57
Show file tree
Hide file tree
Showing 20 changed files with 717 additions and 427 deletions.
23 changes: 16 additions & 7 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* liability that might arise from its use.
------------------------------------------------------------------------------------ */

body { position: relative; margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; color: #222; background-color: #ffffff; line-height: 1; }
body { position: relative; margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; color: #222; background-color: #ffffff; line-height: 1.2; }
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; }
Expand All @@ -19,8 +19,11 @@ input, button { outline: none; }
button { cursor: pointer; }
p { font-size: 18px; color: #494949; }
a { text-decoration: none; color: #4495d4; }
small, sub, sup { padding: 5px 0; color: #666; font-size: 12px; }
sub, sup { font-style: italic; }
a:hover { text-decoration: underline; }
input[type="text"]:invalid ~ input[type="submit"] { opacity: 0.5; pointer-events: none; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23777'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>"); }

/* Page structure */
.wrap { min-height: 100vh; overflow: hidden; }
Expand All @@ -33,16 +36,19 @@ body.main { background-color: #1f242b; color: #f0f6fc; }
.search-box-main, .password-generator { text-align: center; margin-top: 10%; }
.search-box-main h1 { font-size: 70px; }
.search-box-main .search, .password-generator .password { padding: 10px 20px; width: 600px; color: #f0f6fc; background-color: #333333; font-size: 32px; font-family: sans-serif; border: 1px solid #3C4043; border-radius: 10px; }
.search-box-buttons button { margin: 30px 20px 10px 20px; padding: 13px 10px 13px 10px; min-width: 130px; color: #f0f6fc; background-color: #333333; font-size: 14px; border: 1px solid #1c1c1c; border-radius: 6px; }
.search-box-main .search[type="search"]::-webkit-search-cancel-button { background-size: 28px 28px; height: 28px; width: 28px; background-color: #f0f6fc; }
.search-box-buttons button { margin: 30px 20px 10px 20px; padding: 13px 10px 13px 10px; min-width: 130px; color: #f0f6fc; background-color: #333333; font-size: 14px; border: 1px solid #3C4043; border-radius: 6px; }
.search-box-buttons button:hover { border: 1px solid #5f6368; }

.password-generator { margin: 30px auto; padding: 0; }
.password-generator .password { margin: 10px auto; width: 300px; text-align: center; font-size: 14px; }

/* Search Results - Header */
.header-wrap { background-color: #1f242b; color: #f0f6fc; border-bottom: 2px solid #1fa4d1; }
.header-wrap .search { position: relative; margin: 28px 0 28px 158px; padding: 5px 5px 5px 15px; height: 30px; width: 580px; color: #f0f6fc; background-color: #1f242b; font-size: 100%; font-weight: 400; border: 1px solid #303842; border-radius: 10px 0 0 10px; }
.header-wrap .button { position: relative; margin: 28px 10px 28px 0; padding: 5px 20px 5px 15px; height: 40px; color: #f0f6fc; background-color: #1fa4d1; font-size: 100%; font-weight: 400; border: none; border-radius: 0 10px 10px 0; }
.header-wrap .search, .header-wrap .button { position: relative; height: 40px; color: #f0f6fc; font-size: 100%; font-weight: 400; }
.header-wrap .search { margin: 28px 0 28px 158px; padding: 5px 5px 5px 15px; width: 580px; background-color: #1f242b; border: 1px solid #303842; border-radius: 10px 0 0 10px; }
.header-wrap .search[type="search"]::-webkit-search-cancel-button { background-size: 20px 20px; height: 20px; width: 20px; background-color: #f0f6fc; }
.header-wrap .button { margin: 28px 10px 28px 0; padding: 5px 20px 5px 15px; background-color: #1fa4d1; border: none; border-radius: 0 10px 10px 0; }

/* Search results - Header Navigation */
.navigation-header { margin-left: 165px; margin-bottom: 10px; }
Expand All @@ -55,7 +61,7 @@ body.main { background-color: #1f242b; color: #f0f6fc; }
/* Search results - Main column */
.main-column { width: 100%; }
.main-column ol .result { margin: .50rem 0 .50rem 0; padding: 0; }
.main-column ol .special-result, .main-column ol .meta-time, .main-column ol .meta-error, .main-column ol .meta-did-you-mean { margin: .75rem 0 .75rem 0; padding: .5rem 10px; }
.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; }
Expand All @@ -82,7 +88,9 @@ body.main { background-color: #1f242b; color: #f0f6fc; }
}
.main-column ol.image-grid .result .image-box { position: relative; }
.main-column ol.image-grid .result .image-box::after { display: block; padding-bottom: 100%; content: ""; }
.main-column ol.image-grid .result .image-box img { position: absolute; object-fit: cover; width: 100%; height: 100%; }
.main-column ol.image-grid .result .image-box img { position: absolute; object-fit: cover; width: 100%; height: 100%; border-radius: 10px; }
.main-column ol.image-grid .result .image-box img:hover { outline: none; border-color: #3C4043; box-shadow: 0 0 10px #3C4043; }
.main-column ol.image-grid .result span { padding: 5px 0 0 0; color: #666; font-size: 12px; }

/* Special results - Main column */
.main-column ol .special-result { background-color: #fefefe; }
Expand All @@ -102,7 +110,8 @@ body.main { background-color: #1f242b; color: #f0f6fc; }
.no-decoration, .no-decoration:hover { text-decoration: none; }
.hide { display: none; }
.G { color: #1fa4d1; }
.meta-error { position: relative; overflow: hidden; color: #c00; background-color: #ffebe8; border: 1px solid #c00; border-radius: 8px; }
.warning { position: relative; overflow: hidden; margin: 1rem 0 1rem 0; padding: .5rem 10px; color: #db9900; background-color: #ffffe0; border: 1px solid #e6db55; border-radius: 10px; }
.error { position: relative; overflow: hidden; margin: 1rem 0 1rem 0; padding: .5rem 10px; color: #c00; background-color: #ffebe8; border: 1px solid #c00; border-radius: 10px; }
.auth-error { margin-top: 15%; font-size: 32px; text-align: center; color: #eaeaea; }

/* Footer bar */
Expand Down
58 changes: 32 additions & 26 deletions config.php → config.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
A simple lowercase passphrase (something simple like: j9fg-i2du-er6m or 1846) used for caching results. This helps to differentiate between instances on the same server.
You can also add it to your url/bookmark as a simple passphrase to keep unwanted users out.
HASH AUTH:
Use the above hash as a simple passphrase.
Using it as a passphrase lets you host Goosle on a public server without providing a public service.
Usage: https://example.com/?a=1234567890
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.
"on" (Recommended) for active sites, requires APCu
Expand All @@ -23,24 +30,13 @@
CACHE_TIME:
Minutes the result should be cached in ACPu.
HASH AUTH:
Use the above hash as a simple passphrase.
Using it as a passphrase lets you host Goosle on a public server without providing a public service.
Usage: https://example.com/?a=1234567890
Disclaimer: This is not meant to 'hack proof' or truly secure the setup. Just a simple token to keep surface level prying eyes out.
RAW OUTPUT:
"off" (Recommended) for active sites
"on" Output the search results as an array instead of formatted with HTML
ENABLE TORRENT SEARCH:
Enable or disable searching for torrent downloads.
ENABLE IMAGE SEARCH:
Enable or disable image searches - Search results are provided by Qwant.
"on" (Default)
"off"
ENABLE IMAGE SEARCH:
Enable or disable image searches - Search results are provided by Qwant.
ENABLE TORRENT SEARCH:
Enable or disable searching for torrent downloads.
"on" (Default)
"off"
Expand All @@ -58,6 +54,9 @@
Chrome may attract attention because of the lack of Chrome information (tracking) aside from the user agent.
Opera/Edge/Brave and many others use Chrome under the hood and are not a good pick for that reason.
SHOW ZERO SEEDERS:
Set to "on" to include results with 0 seeders (slow or stale downloads). Off to exclude these results.
BLOCK 1337x CATEGORIES:
Add category IDs of 1337x categories, check /engines/torrent/1337x.php for a list of known categories.
Expand All @@ -75,29 +74,35 @@

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

"enable_torrent_search" => "on", // (Default: on)
"enable_image_search" => "on", // (Default: on)
"enable_image_search" => "on", // Default: on
"enable_torrent_search" => "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
),

"user_agents" => array(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15) Gecko/20100101 Firefox/119.0", // macOS 10.15, FF 119
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) Gecko/20100101 Firefox/116.0", // Windows 10, FF 116
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64) Gecko/20100101 Firefox/83.0", // Linux Ubuntu, FF 83
"Mozilla/5.0 (X11; Linux i686) Gecko/20100101 Firefox/119.0", // Linux Generic, FF 119
"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
"leetx_categories_blocked" => array(3, 7, 47), // Default: 3, 7, 47
"piratebay_categories_blocked" => array(206, 210), // Default: 206, 210
"yts_categories_blocked" => array("horror"), // Default: "horror"
Expand All @@ -108,6 +113,7 @@
"udp://exodus.desync.com:6969/announce",
"udp://tracker.torrent.eu.org:451/announce",
),
"version" => "1.0.2"

"version" => "1.1b2" // Please don't change this
);
?>
14 changes: 8 additions & 6 deletions engines/duckduckgo.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,23 @@ public function get_request_url() {
}

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

if(!$xpath) return $results;
if(!$xpath) return array();

// Scrape recommended
$didyoumean = $xpath->query(".//div[@id='did_you_mean']/a[1]")[0];
if(!is_null($didyoumean)) {
array_push($results, array("did_you_mean" => $didyoumean->textContent));
$results['did_you_mean'] = $didyoumean->textContent;
}
$search_specific = $xpath->query(".//div[@id='did_you_mean']/a[2]")[0];
if(!is_null($search_specific)) {
array_push($results, array("search_specific" => $search_specific->textContent));
$results['search_specific'] = $search_specific->textContent;
}

foreach($xpath->query("/html/body/div[1]/div[". count($xpath->query('/html/body/div[1]/div')) ."]/div/div/div[contains(@class, 'web-result')]/div") as $result) {
// Scrape the results
foreach($xpath->query("/html/body/div[1]/div['. count($xpath->query('/html/body/div[1]/div')) .']/div/div/div[contains(@class, 'web-result')]/div") as $result) {
$url = $xpath->evaluate(".//h2[@class='result__title']//a/@href", $result)[0];
if($url == null) continue;

Expand All @@ -79,7 +81,7 @@ public function parse_results($response) {

$description = $xpath->evaluate(".//a[@class='result__snippet']", $result)[0];

array_push($results, array (
array_push($results['search'], array (
"title" => htmlspecialchars($title->textContent),
"url" => htmlspecialchars($url->textContent),
"description" => $description == null ? 'No description was provided for this site.' : htmlspecialchars($description->textContent)
Expand Down
12 changes: 7 additions & 5 deletions engines/google.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,22 @@ public function get_request_url() {
}

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

if(!$xpath) return $results;
if(!$xpath) return array();

// Scrape recommended
$didyoumean = $xpath->query(".//a[@class='gL9Hy']")[0];
if(!is_null($didyoumean)) {
array_push($results, array("did_you_mean" => $didyoumean->textContent));
$results['did_you_mean'] = $didyoumean->textContent;
}
$search_specific = $xpath->query(".//a[@class='spell_orig']")[0];
if(!is_null($search_specific)) {
array_push($results, array("search_specific" => $search_specific->textContent));
$results['search_specific'] = $search_specific->textContent;
}

// Scrape the results
foreach($xpath->query("//div[@id='search']//div[contains(@class, 'g')]") as $result) {
$url = $xpath->evaluate(".//div[@class='yuRUbf']//a/@href", $result)[0];
if($url == null) continue;
Expand All @@ -99,7 +101,7 @@ public function parse_results($response) {

$description = $xpath->evaluate(".//div[contains(@class, 'VwiC3b')]", $result)[0];

array_push($results, array (
array_push($results['search'], array (
"title" => htmlspecialchars($title->textContent),
"url" => htmlspecialchars($url->textContent),
"description" => $description == null ? 'No description was provided for this site.' : htmlspecialchars($description->textContent)
Expand Down
Loading

0 comments on commit 86d0d57

Please sign in to comment.