Skip to content

Commit

Permalink
Version 1.6.1
Browse files Browse the repository at this point in the history
- NOTICE: config.default.php has changed, update your config.php!!
- [new] Query logger for debugging (See config.default.php for details)
- [tweak] Scrape query for DuckDuckGo to be more direct
- [tweak] Added url arguments to the formatted url of search results
- [tweak] Improved tooltips to be popups with better explanations
- [tweak] Improved spacing for pagination links
- [fix] More accurately show the current version in the footer
- [fix] Current version not properly stored
- [fix] Pagination offset off by one result
- [fix] Unnecessary global in load_search()
- [fix] Typo in wordpress search
- [fix] Qwant initial total hits and ranking more accurate
- [fix] Goosle header title not bold on stats page
- [fix] Visual fixes to the design of Goosle
  • Loading branch information
adegans committed Jul 19, 2024
1 parent e0009a7 commit c5de195
Show file tree
Hide file tree
Showing 40 changed files with 436 additions and 181 deletions.
33 changes: 16 additions & 17 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
.startpage .box-office { margin-left:0; border-left:1px solid var(--startpage-button-bg); border-radius:0 6px 6px 0; }
.startpage .web-search:hover, .startpage .image-search:hover, .startpage .magnet-search:hover, .startpage .box-office:hover { border:1px solid var(--startpage-border-alt); background-color:var(--startpage-button-bg-alt); text-decoration:none; }

.startpage .footer { border-top:1px solid var(--color-accent); }

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

Expand All @@ -55,11 +57,11 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
.header .search-field[type="search"]::-webkit-search-cancel-button { background-size:20px 20px; height:20px; width:20px; background-color:var(--text-alt); }
.header .button { margin:0 10px 0 0; padding:5px 20px 5px 15px; color:var(--button-text); background-color:var(--button-bg); border:none; border-radius:0 10px 10px 0; }

.navigation { margin-left:158px; margin-bottom:8px; } /* Margin-bottom must match with padding-bottom on line 79 */
.navigation a { margin-right:20px; border:none; cursor:pointer; text-decoration:none; }
.navigation a:visited { color:var(--link); }
.navigation a:hover { color:var(--text-alt); }
.navigation .active { padding-bottom:8px; border-bottom:4px solid var(--color-accent); }
.header .navigation { margin-left:158px; margin-bottom:10px; }
.header .navigation a { margin-right:20px; border:none; cursor:pointer; text-decoration:none; }
.header .navigation a:visited { color:var(--link); }
.header .navigation a:hover { color:var(--text-alt); }
.header .navigation .active { padding-bottom:8px; border-bottom:4px solid var(--color-accent); }

/* Navigation icons */
.navigation a.tab-search::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--color-accent); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMiwyMEg1YTEsMSwwLDAsMS0xLTFWNUExLDEsMCwwLDEsNSw0aDVWN2EzLDMsMCwwLDAsMywzaDN2MWExLDEsMCwwLDAsMiwwVjlzMCwwLDAtLjA2YTEuMzEsMS4zMSwwLDAsMC0uMDYtLjI3bDAtLjA5YTEuMDcsMS4wNywwLDAsMC0uMTktLjI4aDBsLTYtNmgwYTEuMDcsMS4wNywwLDAsMC0uMjgtLjE5LjMyLjMyLDAsMCwwLS4wOSwwQS44OC44OCwwLDAsMCwxMS4wNSwySDVBMywzLDAsMCwwLDIsNVYxOWEzLDMsMCwwLDAsMywzaDdhMSwxLDAsMCwwLDAtMlpNMTIsNS40MSwxNC41OSw4SDEzYTEsMSwwLDAsMS0xLTFaTTcsOGExLDEsMCwwLDAsMCwySDhBMSwxLDAsMCwwLDgsOFpNMjEuNzEsMjAuMjlsLTEuMTctMS4xNkEzLjQ0LDMuNDQsMCwwLDAsMjAsMTVoMEEzLjQ5LDMuNDksMCwwLDAsMTQsMTcuNDlhMy40NiwzLjQ2LDAsMCwwLDUuMTMsMy4wNWwxLjE2LDEuMTdhMSwxLDAsMCwwLDEuNDIsMEExLDEsMCwwLDAsMjEuNzEsMjAuMjlabS0zLjE3LTEuNzVhMS41NCwxLjU0LDAsMCwxLTIuMTEsMEExLjUsMS41LDAsMCwxLDE2LDE3LjQ5YTEuNDYsMS40NiwwLDAsMSwuNDQtMS4wNiwxLjQ4LDEuNDgsMCwwLDEsMS0uNDNBMS40NywxLjQ3LDAsMCwxLDE5LDE3LjQ5LDEuNSwxLjUsMCwwLDEsMTguNTQsMTguNTRaTTEzLDEySDdhMSwxLDAsMCwwLDAsMmg2YTEsMSwwLDAsMCwwLTJabS0yLDZhMSwxLDAsMCwwLDAtMkg3YTEsMSwwLDAsMCwwLDJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
Expand Down Expand Up @@ -144,8 +146,8 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
.goosebox-body .success, .goosebox-body .fail { font-weight:600; }

/* Stats display (stats page) */
.statspage h1 { margin-bottom:10px; padding:0; text-align:center; font-size:2.5em; font-weight:400; }
.statspage h2 { margin-bottom:10px; padding:0; text-align:center; font-size:1.5em; }
.statspage .content h1 { margin-bottom:10px; padding:0; text-align:center; font-size:2.5em; font-weight:400; }
.statspage .content h2 { margin-bottom:10px; padding:0; text-align:center; font-size:1.5em; }
.statspage p { font-family:'american typewriter'; }

/* oAUTH page */
Expand All @@ -156,9 +158,13 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
.oauthpage .oauth-buttons button { margin:30px 20px 10px 20px; padding:13px 10px; min-width:130px; color:var(--text-alt); background-color:var(--startpage-button-bg); border:1px solid var(--startpage-border); font-size:1.2rem; border-radius:6px; }
.oauthpage .oauth-buttons button:hover { border:1px solid var(--startpage-border-alt); background-color:var(--startpage-button-bg-alt); text-decoration:none; }

/* Tooltips */
.tooltip-question::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--link); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMS4yOSwxNS4yOWExLjU4LDEuNTgsMCwwLDAtLjEyLjE1Ljc2Ljc2LDAsMCwwLS4wOS4xOC42NC42NCwwLDAsMC0uMDYuMTgsMS4zNiwxLjM2LDAsMCwwLDAsLjIuODQuODQsMCwwLDAsLjA4LjM4LjkuOSwwLDAsMCwuNTQuNTQuOTQuOTQsMCwwLDAsLjc2LDAsLjkuOSwwLDAsMCwuNTQtLjU0QTEsMSwwLDAsMCwxMywxNmExLDEsMCwwLDAtLjI5LS43MUExLDEsMCwwLDAsMTEuMjksMTUuMjlaTTEyLDJBMTAsMTAsMCwxLDAsMjIsMTIsMTAsMTAsMCwwLDAsMTIsMlptMCwxOGE4LDgsMCwxLDEsOC04QTgsOCwwLDAsMSwxMiwyMFpNMTIsN0EzLDMsMCwwLDAsOS40LDguNWExLDEsMCwxLDAsMS43MywxQTEsMSwwLDAsMSwxMiw5YTEsMSwwLDAsMSwwLDIsMSwxLDAsMCwwLTEsMXYxYTEsMSwwLDAsMCwyLDB2LS4xOEEzLDMsMCwwLDAsMTIsN1oiIGZpbGw9IiM2NTYzZmYiLz48L3N2Zz4='); }
.tooltip-alert::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--red); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMiwxNmExLDEsMCwxLDAsMSwxQTEsMSwwLDAsMCwxMiwxNlptMTAuNjcsMS40Ny04LjA1LTE0YTMsMywwLDAsMC01LjI0LDBsLTgsMTRBMywzLDAsMCwwLDMuOTQsMjJIMjAuMDZhMywzLDAsMCwwLDIuNjEtNC41M1ptLTEuNzMsMmExLDEsMCwwLDEtLjg4LjUxSDMuOTRhMSwxLDAsMCwxLS44OC0uNTEsMSwxLDAsMCwxLDAtMWw4LTE0YTEsMSwwLDAsMSwxLjc4LDBsOC4wNSwxNEExLDEsMCwwLDEsMjAuOTQsMTkuNDlaTTEyLDhhMSwxLDAsMCwwLTEsMXY0YTEsMSwwLDAsMCwyLDBWOUExLDEsMCwwLDAsMTIsOFoiIGZpbGw9IiM2NTYzZmYiLz48L3N2Zz4='); }

/* Pagination */
.pagination { text-align:center; }
.pagination a { font-size:1.2em; }
.pagination a { font-size:1.2em; padding:0 8px; }
.pagination a.current { font-size:1.4em; font-weight:400; text-decoration:underline; }
.arrow-left::before { content:""; display:inline-block; width:1.2em; height:1.2em; background:var(--link); vertical-align:text-top; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE3LDExSDkuNDFsMy4zLTMuMjlhMSwxLDAsMSwwLTEuNDItMS40MmwtNSw1YTEsMSwwLDAsMC0uMjEuMzMsMSwxLDAsMCwwLDAsLjc2LDEsMSwwLDAsMCwuMjEuMzNsNSw1YTEsMSwwLDAsMCwxLjQyLDAsMSwxLDAsMCwwLDAtMS40Mkw5LjQxLDEzSDE3YTEsMSwwLDAsMCwwLTJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
.arrow-right::before { content:""; display:inline-block; width:1.2em; height:1.2em; background:var(--link); vertical-align:text-top; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE3LjkyLDExLjYyYTEsMSwwLDAsMC0uMjEtLjMzbC01LTVhMSwxLDAsMCwwLTEuNDIsMS40MkwxNC41OSwxMUg3YTEsMSwwLDAsMCwwLDJoNy41OWwtMy4zLDMuMjlhMSwxLDAsMCwwLDAsMS40MiwxLDEsMCwwLDAsMS40MiwwbDUtNWExLDEsMCwwLDAsLjIxLS4zM0ExLDEsMCwwLDAsMTcuOTIsMTEuNjJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
Expand All @@ -170,7 +176,7 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
.footer-grid:nth-child(2) { text-align:right; }

/* Footer */
.footer { box-sizing:border-box; bottom:0; margin-top:auto; padding:10px 5px; width:100%; background-color:var(--background-alt); color:var(--text-alt); border-top:2px solid var(--color-accent); font-size:.9rem; }
.footer { box-sizing:border-box; bottom:0; margin-top:auto; padding:10px 25px; width:100%; background-color:var(--background-alt); color:var(--text-alt); border-top:2px solid var(--color-accent); }
.footer a { color:var(--text-alt); }

/* MPA rating colors */
Expand All @@ -180,13 +186,6 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
.mpa-r { color:#C0392B; }
.mpa-nc17 { color:#1A5276; }

/* Tooltips */
.tooltip { position:relative; display:inline-block; }
.tooltip-question::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--link); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMS4yOSwxNS4yOWExLjU4LDEuNTgsMCwwLDAtLjEyLjE1Ljc2Ljc2LDAsMCwwLS4wOS4xOC42NC42NCwwLDAsMC0uMDYuMTgsMS4zNiwxLjM2LDAsMCwwLDAsLjIuODQuODQsMCwwLDAsLjA4LjM4LjkuOSwwLDAsMCwuNTQuNTQuOTQuOTQsMCwwLDAsLjc2LDAsLjkuOSwwLDAsMCwuNTQtLjU0QTEsMSwwLDAsMCwxMywxNmExLDEsMCwwLDAtLjI5LS43MUExLDEsMCwwLDAsMTEuMjksMTUuMjlaTTEyLDJBMTAsMTAsMCwxLDAsMjIsMTIsMTAsMTAsMCwwLDAsMTIsMlptMCwxOGE4LDgsMCwxLDEsOC04QTgsOCwwLDAsMSwxMiwyMFpNMTIsN0EzLDMsMCwwLDAsOS40LDguNWExLDEsMCwxLDAsMS43MywxQTEsMSwwLDAsMSwxMiw5YTEsMSwwLDAsMSwwLDIsMSwxLDAsMCwwLTEsMXYxYTEsMSwwLDAsMCwyLDB2LS4xOEEzLDMsMCwwLDAsMTIsN1oiIGZpbGw9IiM2NTYzZmYiLz48L3N2Zz4='); }
.tooltip-alert::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--link); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMiwxNmExLDEsMCwxLDAsMSwxQTEsMSwwLDAsMCwxMiwxNlptMTAuNjcsMS40Ny04LjA1LTE0YTMsMywwLDAsMC01LjI0LDBsLTgsMTRBMywzLDAsMCwwLDMuOTQsMjJIMjAuMDZhMywzLDAsMCwwLDIuNjEtNC41M1ptLTEuNzMsMmExLDEsMCwwLDEtLjg4LjUxSDMuOTRhMSwxLDAsMCwxLS44OC0uNTEsMSwxLDAsMCwxLDAtMWw4LTE0YTEsMSwwLDAsMSwxLjc4LDBsOC4wNSwxNEExLDEsMCwwLDEsMjAuOTQsMTkuNDlaTTEyLDhhMSwxLDAsMCwwLTEsMXY0YTEsMSwwLDAsMCwyLDBWOUExLDEsMCwwLDAsMTIsOFoiIGZpbGw9IiM2NTYzZmYiLz48L3N2Zz4='); }
.tooltip .tooltiptext { visibility:hidden; position:absolute; padding:10px 15px; width:350px; background:var(--background-popup); border:1px solid var(--border); border-radius:10px; z-index: 10000; }
.tooltip:hover .tooltiptext { visibility:visible; }

/* Misc */
.goosle-g { color:var(--color-accent); }
.green { color:var(--green); }
Expand All @@ -201,7 +200,7 @@ img.help { padding:0 .5rem .5rem 0; float:left; border-radius:20px; }
.error { position:relative; overflow:hidden; margin:20px 0; padding:10px; color:var(--error); background-color:var(--error-background); border:1px solid var(--error); border-radius:10px; }
.auth-success { margin-top:15%; text-align:center; color:var(--text-alt); }
.auth-error { margin-top:15%; font-size:2rem; text-align:center; color:var(--text-alt); }
a.update { color:var(--red); font-weight:600; }
a.update { color:var(--yellow); font-weight:600; }

@media only screen and (max-width:960px) { /* Tablet, landscape iPad, lo-res/smaller laptops */
.content { position:relative; margin:15px 48px; }
Expand Down
2 changes: 1 addition & 1 deletion box-office.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@

<div class="footer grid-container">
<div class="footer-grid">
&copy; <?php echo the_date('Y'); ?> <?php echo show_version(); ?> By <a href="https://ajdg.solutions/" target="_blank">Arnan de Gans</a>.
&copy; <?php echo the_date('Y'); ?> Goosle <?php echo $current_version; ?> <?php echo show_update_notification(); ?>
</div>
<div class="footer-grid">
<a href="./?a=<?php echo $opts->user_auth; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->user_auth; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->user_auth; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>
Expand Down
16 changes: 16 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Goosle
## The best Meta Search Engine to find everything

### 1.6.1 - July 19, 2024
- NOTICE: config.default.php has changed, update your config.php!!
- [new] Query logger for debugging (See config.default.php for details)
- [tweak] Scrape query for DuckDuckGo to be more direct
- [tweak] Added url arguments to the formatted url of search results
- [tweak] Improved tooltips to be popups with better explanations
- [tweak] Improved spacing for pagination links
- [fix] More accurately show the current version in the footer
- [fix] Current version not properly stored
- [fix] Pagination offset off by one result
- [fix] Unnecessary global in load_search()
- [fix] Typo in wordpress search
- [fix] Qwant initial total hits and ranking more accurate
- [fix] Goosle header title not bold on stats page
- [fix] Visual fixes to the design of Goosle

### 1.6 - July 15, 2024
- NOTICE: config.default.php has changed, update your config.php!!
- [change] Moved magnet popups into combined function
Expand Down
13 changes: 13 additions & 0 deletions config.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,26 @@
The file cache is only limited by your hosting storage space and can safely be much much longer if you want.
To not show outdated results the 'limit' is 48 hours.
Ignored if above 'CACHE_TYPE' option is set to off.
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%3A1&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.
/* ------------------------------------------------------------------------------------
LANGUAGE:
To not fit the USA mold, Goosle defaults to the United Kingdom for english results.
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.
Google has no language setting because as soon as you specify it all 'anonymous' settings stop working.
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/.
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.)
Qwant uses a locale similar to DuckDuckGo and defaults to the United Kingdom as well.
Expand Down Expand Up @@ -104,6 +116,7 @@
'cache_type' => 'file', // Default: file
'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)
'querylog' => 'off', // Default: off (Log remote queries to see if they are made and how much results they find and end up with)

'enable_duckduckgo' => 'on', // Default: on
'enable_google' => 'on', // Default: on
Expand Down
14 changes: 11 additions & 3 deletions engines/boxoffice/eztv.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ function eztv_boxoffice($opts) {
$results = $results_temp = array();

// No response
if(empty($json_response)) return $results;
if(empty($json_response)) {
if($opts->querylog == 'on') querylog('BoxofficeEZTV', 'a', $api_url, 'No response', 0);
return $results;
}

// Nothing found
if($json_response['torrents_count'] == 0) return $results;
// No Results
if($json_response['torrents_count'] == 0) {
if($opts->querylog == 'on') querylog('BoxofficeEZTV', 'a', $api_url, 'No Results', 0);
return $results;
}

foreach($json_response['torrents'] as $result) {
$title = (!empty($result['title'])) ? sanitize($result['title']) : null;
Expand Down Expand Up @@ -92,6 +98,8 @@ function eztv_boxoffice($opts) {
}
unset($response, $json_response);

if($opts->querylog == 'on') querylog('BoxofficeEZTV', 'a', $api_url, 'up-to 100', count($results));

// Cache last request if there is something to cache
if($opts->cache_type !== 'off') {
if(count($results) > 0) store_cached_results($opts->cache_type, $opts->hash, $api_url, $results, $opts->cache_time);
Expand Down
14 changes: 11 additions & 3 deletions engines/boxoffice/yts.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ function yts_boxoffice($opts, $what) {
$results = array();

// No response
if(empty($json_response)) return $results;
if(empty($json_response)) {
if($opts->querylog == 'on') querylog('BoxofficeYTS', 'a', $api_url, 'No response', 0);
return $results;
}

// No results
if($json_response['data']['movie_count'] == 0) return $results;
// No Results
if($json_response['data']['movie_count'] == 0) {
if($opts->querylog == 'on') querylog('BoxofficeYTS', 'a', $api_url, 'No Results', 0);
return $results;
}

foreach($json_response['data']['movies'] as $result) {
$title = sanitize($result['title']);
Expand Down Expand Up @@ -99,6 +105,8 @@ function yts_boxoffice($opts, $what) {
}
unset($response, $json_response);

if($opts->querylog == 'on') querylog('BoxofficeYTS', 'a', $api_url, 'up-to 40', count($results));

// Cache last request if there is something to cache
if($opts->cache_type !== 'off') {
if(count($results) > 0) store_cached_results($opts->cache_type, $opts->hash, $api_url, $results, $opts->cache_time);
Expand Down
12 changes: 10 additions & 2 deletions engines/image/openverse.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,19 @@ public function parse_results($response) {
$json_response = json_decode($response, true);

// No response
if(empty($json_response)) return $engine_temp;
if(empty($json_response)) {
if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
return $engine_result;
}

// Figure out results and base rank
$number_of_results = $rank = $json_response['result_count'];

// No results
if($number_of_results == 0) return $engine_temp;
if($number_of_results == 0) {
if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);
return $engine_result;
}

// Use API result
foreach($json_response['results'] as $result) {
Expand Down Expand Up @@ -106,6 +112,8 @@ public function parse_results($response) {
$engine_result['search'] = $engine_temp;
}

if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $number_of_results, count($engine_temp));

unset($response, $json_response, $number_of_results, $rank);

return $engine_result;
Expand Down
12 changes: 10 additions & 2 deletions engines/image/qwant-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,19 @@ public function parse_results($response) {
$json_response = json_decode($response, true);

// No response
if(empty($json_response)) return $engine_temp;
if(empty($json_response)) {
if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
return $engine_result;
}

// Figure out results and base rank
$number_of_results = $rank = $json_response['data']['result']['total'];

// No results
if($number_of_results == 0) return $engine_temp;
if($number_of_results == 0) {
if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);
return $engine_result;
}

foreach($json_response['data']['result']['items'] as $result) {
// Find data and process data
Expand Down Expand Up @@ -111,6 +117,8 @@ public function parse_results($response) {
$engine_result['search'] = $engine_temp;
}

if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $number_of_results, count($engine_temp));

unset($response, $json_response, $number_of_results, $rank);

return $engine_result;
Expand Down
Loading

0 comments on commit c5de195

Please sign in to comment.