forked from lolcat/4get
Compare commits
52 Commits
Author | SHA1 | Date |
---|---|---|
lolcat | 920b9d5b3f | |
lolcat | 9cd369ac08 | |
lolcat | e83865be49 | |
lolcat | 68dd7f29f6 | |
lolcat | aaa30c79f5 | |
lolcat | 070f9d442b | |
lolcat | 9c18753ec3 | |
lolcat | d8a729796e | |
lolcat | 2bbe5a29a9 | |
lolcat | 9ac195ac3b | |
lolcat | d427a48ed4 | |
lolcat | 12d5b4ade8 | |
Pano | c422abbdc6 | |
Pano | 85246cc7ec | |
Pano | d709d12111 | |
lolcat | 6eabc3edf4 | |
Pano | 19f82a8536 | |
Pano | 155a38d454 | |
Pano | 6926e374af | |
lolcat | 458bd8c1b5 | |
lolcat | c6cf9afb6e | |
lolcat | 435913a1e5 | |
lolcat | e4f94c43db | |
lolcat | c9eec8260b | |
lolcat | 063397dbd1 | |
lolcat | 1a5a653be3 | |
lolcat | 3b353c2837 | |
lolcat | 913e4d7e39 | |
lolcat | 08ed77f947 | |
lolcat | 883a650f84 | |
lolcat | fbac3eeb8d | |
lolcat | 36993013e5 | |
lolcat | beb08f46e2 | |
lolcat | 4e4796bb71 | |
lolcat | ff06bc1f51 | |
lolcat | d0ca0f46a7 | |
lolcat | 8a32827a39 | |
lolcat | 143c0c1364 | |
lolcat | 497dacd42e | |
lolcat | 029af216d4 | |
lolcat | 2a1655af9a | |
lolcat | 6f91ec9d4f | |
lolcat | 53d40c6e4e | |
lolcat | feb0a6dfc3 | |
lolcat | 9c00182b2e | |
lolcat | 03ccd75f4b | |
lolcat | 7a91eb7839 | |
lolcat | 6df9d17ada | |
lolcat | 8161f8e7b8 | |
lolcat | d3fe37e7b6 | |
lolcat | e252bf4fce | |
lolcat | b98a393421 |
37
README.md
37
README.md
|
@ -1,4 +1,4 @@
|
||||||
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/W7W2OZK5H)
|
## <a href="https://4get.ca/donate">Donate to the project here!</a>
|
||||||
|
|
||||||
# 4get search
|
# 4get search
|
||||||
**4get** is a proxy search engine that doesn't suck.
|
**4get** is a proxy search engine that doesn't suck.
|
||||||
|
@ -6,17 +6,16 @@
|
||||||
## About 4get
|
## About 4get
|
||||||
https://4get.ca/about
|
https://4get.ca/about
|
||||||
|
|
||||||
## Try it out
|
## Official instance
|
||||||
https://4get.ca
|
https://4get.ca , or visit the official instance list: https://4get.ca/instances
|
||||||
|
|
||||||
## Totally unbiased comparison between alternatives
|
## Totally unbiased comparison between alternatives
|
||||||
|
|
||||||
| | 4get | searx(ng) | librex | araa |
|
| | 4get | searx(ng) | libreY | araa | hearch |
|
||||||
|----------------------------|-------------------------|-----------|-------------|-----------|
|
|----------------------------|-------------------------|-----------|-------------|-----------|-------------------|
|
||||||
| RAM usage | 200-400mb~ | 2GB~ | 200-400mb~ | 2GB~ |
|
| RAM usage | 200-400mb~ | 2GB~ | 200-400mb~ | 2GB~ | idk |
|
||||||
| Does it suck | no (debunked by snopes) | yes | yes | a little |
|
| Does it suck | no (debunked by snopes) | yes | yes | a little | better than searx |
|
||||||
| Does it work | ye | sometimes | no | sometimes |
|
| Does it work | ye | sometimes | sometimes | sometimes | yes |
|
||||||
| Did the dev commit suicide | not until my 30s | no | allegedly | no |
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
1. Rotating proxies on a per-scraper basis
|
1. Rotating proxies on a per-scraper basis
|
||||||
|
@ -35,13 +34,16 @@ tl;dr the best way to actually browse for shit.
|
||||||
| DuckDuckGo | DuckDuckGo | YouTube | DuckDuckGo | Soundcloud | Brave |
|
| DuckDuckGo | DuckDuckGo | YouTube | DuckDuckGo | Soundcloud | Brave |
|
||||||
| Brave | Brave | DuckDuckGo | Brave | | DuckDuckGo |
|
| Brave | Brave | DuckDuckGo | Brave | | DuckDuckGo |
|
||||||
| Yandex | Yandex | Brave | Google | | Yandex |
|
| Yandex | Yandex | Brave | Google | | Yandex |
|
||||||
| Google | Google | Yandex | Qwant | | Google |
|
| Google | Google | Yandex | Startpage | | Google |
|
||||||
| Qwant | Qwant | Google | Mojeek | | Qwant |
|
| Startpage | Startpage | Google | Qwant | | Startpage |
|
||||||
| Yep | Yep | Qwant | | | Yep |
|
| Qwant | Qwant | Startpage | Mojeek | | Kagi |
|
||||||
| Greppr | Imgur | | | | Marginalia |
|
| Ghostery | Yep | Qwant | | | Qwant |
|
||||||
| Crowdview | FindThatMeme | | | | YouTube |
|
| Yep | Solofield | Solofield | | | Ghostery |
|
||||||
| Mwmbl | | | | | Soundcloud |
|
| Greppr | Imgur | | | | Yep |
|
||||||
| Mojeek | | | | | |
|
| Crowdview | FindThatMeme | | | | Marginalia |
|
||||||
|
| Mwmbl | | | | | YouTube |
|
||||||
|
| Mojeek | | | | | Soundcloud |
|
||||||
|
| Solofield | | | | | |
|
||||||
| Marginalia | | | | | |
|
| Marginalia | | | | | |
|
||||||
| wiby | | | | | |
|
| wiby | | | | | |
|
||||||
| Curlie | | | | | |
|
| Curlie | | | | | |
|
||||||
|
@ -51,3 +53,6 @@ Refer to the <a href="https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/"
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
Shit breaks all the time but I repair it all the time too... Email me here: <b>will (at) lolcat.ca</b> or create an issue.
|
Shit breaks all the time but I repair it all the time too... Email me here: <b>will (at) lolcat.ca</b> or create an issue.
|
||||||
|
|
||||||
|
## License
|
||||||
|
AGPL
|
||||||
|
|
|
@ -18,7 +18,10 @@ class autocomplete{
|
||||||
"yep" => "https://api.yep.com/ac/?query={searchTerms}",
|
"yep" => "https://api.yep.com/ac/?query={searchTerms}",
|
||||||
"marginalia" => "https://search.marginalia.nu/suggest/?partial={searchTerms}",
|
"marginalia" => "https://search.marginalia.nu/suggest/?partial={searchTerms}",
|
||||||
"yt" => "https://suggestqueries-clients6.youtube.com/complete/search?client=youtube&q={searchTerms}",
|
"yt" => "https://suggestqueries-clients6.youtube.com/complete/search?client=youtube&q={searchTerms}",
|
||||||
"sc" => ""
|
"sc" => "",
|
||||||
|
"startpage" => "https://www.startpage.com/suggestions?q={searchTerms}&format=opensearch&segment=startpage.defaultffx&lui=english",
|
||||||
|
"kagi" => "https://kagi.com/api/autosuggest?q={searchTerms}",
|
||||||
|
"ghostery" => "https://ghosterysearch.com/suggest?q={searchTerms}"
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -11,7 +11,7 @@ class config{
|
||||||
const SERVER_NAME = "4get";
|
const SERVER_NAME = "4get";
|
||||||
|
|
||||||
// Will be shown in <meta> tag on home page
|
// Will be shown in <meta> tag on home page
|
||||||
const SERVER_SHORT_DESCRIPTION = "They live in our walls!";
|
const SERVER_SHORT_DESCRIPTION = "4get is a proxy search engine that doesn't suck.";
|
||||||
|
|
||||||
// Will be shown in server list ping (null for no description)
|
// Will be shown in server list ping (null for no description)
|
||||||
const SERVER_LONG_DESCRIPTION = null;
|
const SERVER_LONG_DESCRIPTION = null;
|
||||||
|
@ -63,6 +63,14 @@ class config{
|
||||||
//"via"
|
//"via"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Block SSL ciphers used by CLI tools used for botting
|
||||||
|
// Basically a primitive version of Cloudflare's browser integrity check
|
||||||
|
// ** If curl can still access the site (with spoofed headers), please make sure you use the new apache2 config **
|
||||||
|
// https://git.lolcat.ca/lolcat/4get/docs/apache2.md
|
||||||
|
const DISALLOWED_SSL = [
|
||||||
|
// "TLS_AES_256_GCM_SHA384" // used by WGET and CURL
|
||||||
|
];
|
||||||
|
|
||||||
// Maximal number of searches per captcha key/pass issued. Counter gets
|
// Maximal number of searches per captcha key/pass issued. Counter gets
|
||||||
// reset on every APCU cache clear (should happen once a day).
|
// reset on every APCU cache clear (should happen once a day).
|
||||||
// Only useful when BOT_PROTECTION is NOT set to 0
|
// Only useful when BOT_PROTECTION is NOT set to 0
|
||||||
|
@ -111,7 +119,7 @@ class config{
|
||||||
|
|
||||||
// Default user agent to use for scraper requests. Sometimes ignored to get specific webpages
|
// Default user agent to use for scraper requests. Sometimes ignored to get specific webpages
|
||||||
// Changing this might break things.
|
// Changing this might break things.
|
||||||
const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0";
|
const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0";
|
||||||
|
|
||||||
// Proxy pool assignments for each scraper
|
// Proxy pool assignments for each scraper
|
||||||
// false = Use server's raw IP
|
// false = Use server's raw IP
|
||||||
|
@ -121,11 +129,15 @@ class config{
|
||||||
const PROXY_BRAVE = false;
|
const PROXY_BRAVE = false;
|
||||||
const PROXY_FB = false; // facebook
|
const PROXY_FB = false; // facebook
|
||||||
const PROXY_GOOGLE = false;
|
const PROXY_GOOGLE = false;
|
||||||
|
const PROXY_GOOGLE_CSE = false;
|
||||||
|
const PROXY_STARTPAGE = false;
|
||||||
const PROXY_QWANT = false;
|
const PROXY_QWANT = false;
|
||||||
|
const PROXY_GHOSTERY = false;
|
||||||
const PROXY_MARGINALIA = false;
|
const PROXY_MARGINALIA = false;
|
||||||
const PROXY_MOJEEK = false;
|
const PROXY_MOJEEK = false;
|
||||||
const PROXY_SC = false; // soundcloud
|
const PROXY_SC = false; // soundcloud
|
||||||
const PROXY_SPOTIFY = false;
|
const PROXY_SPOTIFY = false;
|
||||||
|
const PROXY_SOLOFIELD = false;
|
||||||
const PROXY_WIBY = false;
|
const PROXY_WIBY = false;
|
||||||
const PROXY_CURLIE = false;
|
const PROXY_CURLIE = false;
|
||||||
const PROXY_YT = false; // youtube
|
const PROXY_YT = false; // youtube
|
||||||
|
@ -146,6 +158,9 @@ class config{
|
||||||
// Scraper-specific parameters
|
// Scraper-specific parameters
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// GOOGLE CSE
|
||||||
|
const GOOGLE_CX_ENDPOINT = "d4e68b99b876541f0";
|
||||||
|
|
||||||
// MARGINALIA
|
// MARGINALIA
|
||||||
// Use "null" to default out to HTML scraping OR specify a string to
|
// Use "null" to default out to HTML scraping OR specify a string to
|
||||||
// use the API (Eg: "public"). API has less filters.
|
// use the API (Eg: "public"). API has less filters.
|
||||||
|
|
|
@ -0,0 +1,195 @@
|
||||||
|
# Sample Apache2 configuration
|
||||||
|
This is the apache2 configuration file used on the 4get.ca official instance, in hopes that it's useful to you!
|
||||||
|
|
||||||
|
Looking for the apache2 guide? <a href="https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/apache2.md">go here.</a>.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName www.4get.ca
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/4get.ca/chain.pem
|
||||||
|
|
||||||
|
RedirectMatch 301 ^(.*)$ https://4get.ca$1
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName 4get.ca
|
||||||
|
|
||||||
|
ServerAdmin will@lolcat.ca
|
||||||
|
DocumentRoot /var/www/4get
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLOptions +StdEnvVars
|
||||||
|
|
||||||
|
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
|
||||||
|
AddOutputFilterByType DEFLATE application/json
|
||||||
|
AddOutputFilterByType DEFLATE application/javascript
|
||||||
|
AddOutputFilterByType DEFLATE application/x-javascript
|
||||||
|
AddOutputFilterByType DEFLATE text/html
|
||||||
|
AddOutputFilterByType DEFLATE text/plain
|
||||||
|
AddOutputFilterByType DEFLATE text/css
|
||||||
|
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/4get.ca/chain.pem
|
||||||
|
|
||||||
|
<Directory /var/www/4get>
|
||||||
|
Options -MultiViews
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
# deny access to private resources
|
||||||
|
<Directory /var/www/4get/data/>
|
||||||
|
Order Deny,allow
|
||||||
|
Deny from all
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName www.lolcat.ca
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/4get.ca/chain.pem
|
||||||
|
|
||||||
|
RedirectMatch 301 ^(.*)$ https://lolcat.ca$1
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName lolcat.ca
|
||||||
|
|
||||||
|
ServerAdmin will@lolcat.ca
|
||||||
|
DocumentRoot /var/www/lolcat
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLOptions +StdEnvVars
|
||||||
|
|
||||||
|
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
|
||||||
|
AddOutputFilterByType DEFLATE application/json
|
||||||
|
AddOutputFilterByType DEFLATE application/javascript
|
||||||
|
AddOutputFilterByType DEFLATE application/x-javascript
|
||||||
|
AddOutputFilterByType DEFLATE text/html
|
||||||
|
AddOutputFilterByType DEFLATE text/plain
|
||||||
|
AddOutputFilterByType DEFLATE text/css
|
||||||
|
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/4get.ca/chain.pem
|
||||||
|
|
||||||
|
<Directory /var/www/lolcat>
|
||||||
|
Options -MultiViews
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName www.nyym.co
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/nyym.co/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/nyym.co/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/nyym.co/chain.pem
|
||||||
|
|
||||||
|
RedirectMatch 301 ^(.*)$ https://nyym.co$1
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName nyym.co
|
||||||
|
|
||||||
|
ServerAdmin will@lolcat.ca
|
||||||
|
DocumentRoot /var/www/nyym
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLOptions +StdEnvVars
|
||||||
|
|
||||||
|
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
|
||||||
|
AddOutputFilterByType DEFLATE application/json
|
||||||
|
AddOutputFilterByType DEFLATE application/javascript
|
||||||
|
AddOutputFilterByType DEFLATE application/x-javascript
|
||||||
|
AddOutputFilterByType DEFLATE text/html
|
||||||
|
AddOutputFilterByType DEFLATE text/plain
|
||||||
|
AddOutputFilterByType DEFLATE text/css
|
||||||
|
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/nyym.co/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/nyym.co/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/nyym.co/chain.pem
|
||||||
|
|
||||||
|
<Directory /var/www/nyym>
|
||||||
|
Options -MultiViews
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName git.lolcat.ca
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLOptions +StdEnvVars
|
||||||
|
|
||||||
|
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
|
||||||
|
AddOutputFilterByType DEFLATE application/json
|
||||||
|
AddOutputFilterByType DEFLATE application/javascript
|
||||||
|
AddOutputFilterByType DEFLATE application/x-javascript
|
||||||
|
AddOutputFilterByType DEFLATE text/html
|
||||||
|
AddOutputFilterByType DEFLATE text/plain
|
||||||
|
AddOutputFilterByType DEFLATE text/css
|
||||||
|
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/4get.ca/chain.pem
|
||||||
|
|
||||||
|
ProxyPreserveHost On
|
||||||
|
ProxyRequests off
|
||||||
|
AllowEncodedSlashes NoDecode
|
||||||
|
ProxyPass / http://localhost:3000/ nocanon
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName live.lolcat.ca
|
||||||
|
|
||||||
|
ServerAdmin will@lolcat.ca
|
||||||
|
DocumentRoot /var/www/live
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLOptions +StdEnvVars
|
||||||
|
|
||||||
|
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
|
||||||
|
AddOutputFilterByType DEFLATE application/json
|
||||||
|
AddOutputFilterByType DEFLATE application/javascript
|
||||||
|
AddOutputFilterByType DEFLATE application/x-javascript
|
||||||
|
AddOutputFilterByType DEFLATE text/html
|
||||||
|
AddOutputFilterByType DEFLATE text/plain
|
||||||
|
AddOutputFilterByType DEFLATE text/css
|
||||||
|
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/4get.ca/chain.pem
|
||||||
|
</VirtualHost>
|
||||||
|
```
|
|
@ -74,7 +74,7 @@ Now, edit the following file: `/etc/apache2/sites-available/000-default.conf`, r
|
||||||
|
|
||||||
DocumentRoot /var/www/4get
|
DocumentRoot /var/www/4get
|
||||||
|
|
||||||
Options +MultiViews
|
Options -MultiViews
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
@ -92,23 +92,35 @@ To make the above snippet work, please refer to our <a href="https://git.lolcat.
|
||||||
## default-ssl.conf
|
## default-ssl.conf
|
||||||
Now, edit the file `/etc/apache2/sites-available/default-ssl.conf`, remove everything and, again, add each rule while modifying the relevant fields:
|
Now, edit the file `/etc/apache2/sites-available/default-ssl.conf`, remove everything and, again, add each rule while modifying the relevant fields:
|
||||||
|
|
||||||
This ruleset will redirect all clients that specify an unknown `Host` to the domain of our choice. I recommend you uncomment the `ErrorLog` directive while setting things up in case a problem occurs with PHP. Don't worry about the invalid SSL paths, we will generate our certificates later; Just make sure you specify the right domains in there:
|
First, append the following redirect rule to point traffic from `www.4get.ca` to `4get.ca`:
|
||||||
```xml
|
```xml
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
|
ServerName www.4get.ca
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/4get.ca/chain.pem
|
||||||
|
|
||||||
RedirectMatch 301 ^(.*)$ https://4get.ca$1
|
RedirectMatch 301 ^(.*)$ https://4get.ca$1
|
||||||
|
</VirtualHost>
|
||||||
|
```
|
||||||
|
|
||||||
|
This ruleset tells apache2 where 4get is located (`/var/www/4get`), ensures that `4get.ca/settings` resolves to `4get.ca/settings.php` internally and that we deny access to `/data/*`, which may contain files you might want to keep private. `StdEnvVArs+` will make it so that PHP can view if the connection uses HTTPS, and which cipher was used. Useful for basic bot protection.
|
||||||
|
|
||||||
|
Make sure to replace `4get.ca` with your own domain under the `SSLCertificate*` directives!
|
||||||
|
```xml
|
||||||
|
<VirtualHost *:443>
|
||||||
|
ServerName 4get.ca
|
||||||
|
|
||||||
ServerAdmin will@lolcat.ca
|
ServerAdmin will@lolcat.ca
|
||||||
|
DocumentRoot /var/www/4get
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
SSLOptions +StdEnvVars
|
||||||
|
|
||||||
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
|
||||||
SSLEngine on
|
|
||||||
|
|
||||||
<FilesMatch "\.(?:cgi|shtml|phtml|php)$">
|
|
||||||
SSLOptions +StdEnvVars
|
|
||||||
</FilesMatch>
|
|
||||||
<Directory /usr/lib/cgi-bin>
|
|
||||||
SSLOptions +StdEnvVars
|
|
||||||
</Directory>
|
|
||||||
|
|
||||||
AddOutputFilterByType DEFLATE application/json
|
AddOutputFilterByType DEFLATE application/json
|
||||||
AddOutputFilterByType DEFLATE application/javascript
|
AddOutputFilterByType DEFLATE application/javascript
|
||||||
AddOutputFilterByType DEFLATE application/x-javascript
|
AddOutputFilterByType DEFLATE application/x-javascript
|
||||||
|
@ -118,21 +130,18 @@ This ruleset will redirect all clients that specify an unknown `Host` to the dom
|
||||||
|
|
||||||
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
SSLCertificateFile /etc/letsencrypt/live/4get.ca/fullchain.pem
|
||||||
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
SSLCertificateKeyFile /etc/letsencrypt/live/4get.ca/privkey.pem
|
||||||
</VirtualHost>
|
SSLCertificateChainFile /etc/letsencrypt/live/4get.ca/chain.pem
|
||||||
```
|
|
||||||
|
|
||||||
This ruleset tells apache2 where 4get is located (`/var/www/4get`), ensures that `4get.ca/settings` resolves to `4get.ca/settings.php` internally and that we deny access to `/data/*`, which may contain files you might want to keep private.
|
<Directory /var/www/4get>
|
||||||
```xml
|
Options -MultiViews
|
||||||
<VirtualHost *:443>
|
AllowOverride All
|
||||||
ServerName 4get.ca
|
Require all granted
|
||||||
|
|
||||||
DocumentRoot /var/www/4get
|
|
||||||
|
|
||||||
Options +MultiViews
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||||
|
</Directory>
|
||||||
|
|
||||||
# deny access to private resources
|
# deny access to private resources
|
||||||
<Directory /var/www/4get/data/>
|
<Directory /var/www/4get/data/>
|
||||||
|
@ -142,28 +151,7 @@ This ruleset tells apache2 where 4get is located (`/var/www/4get`), ensures that
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
Don't forget to specify your other services here! Here's an example of a ruleset I use for `lolcat.ca`:
|
By default, the first rule dictates where traffic should be redirected to in case the client specifies an unknown domain name. Don't forget your webserver's other rules! For a complete real-world example, please <a href="https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/apache2-example.md">check out my real-world config file I use on 4get.ca</a>.
|
||||||
```xml
|
|
||||||
<VirtualHost *:443>
|
|
||||||
ServerName lolcat.ca
|
|
||||||
|
|
||||||
DocumentRoot /var/www/lolcat
|
|
||||||
|
|
||||||
Options +MultiViews
|
|
||||||
RewriteEngine On
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
|
||||||
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
|
||||||
</VirtualHost>
|
|
||||||
```
|
|
||||||
|
|
||||||
... Alongside with it's redirect rules.
|
|
||||||
```xml
|
|
||||||
<VirtualHost *:443>
|
|
||||||
ServerName www.lolcat.ca
|
|
||||||
RedirectMatch 301 ^(.*)$ https://lolcat.ca$1
|
|
||||||
</VirtualHost>
|
|
||||||
```
|
|
||||||
|
|
||||||
## security.conf
|
## security.conf
|
||||||
If you enabled the `headers` module, you can head over to `/etc/apache2/conf-enabled/security.conf` and edit:
|
If you enabled the `headers` module, you can head over to `/etc/apache2/conf-enabled/security.conf` and edit:
|
||||||
|
|
|
@ -8,10 +8,10 @@ Welcome! This guide assumes that you have a working 4get instance. This will hel
|
||||||
3. The captcha imagesets are located in `data/captcha/your_image_set/*.png`
|
3. The captcha imagesets are located in `data/captcha/your_image_set/*.png`
|
||||||
4. The captcha font is located in `data/fonts/captcha.ttf`
|
4. The captcha font is located in `data/fonts/captcha.ttf`
|
||||||
|
|
||||||
# Cloudflare bypass
|
# Cloudflare bypass (TLS check)
|
||||||
**Note: this only allows you to bypass the browser integrity checks. Captchas & javascript challenges will not be bypassed.**
|
**Note: this only allows you to bypass the browser integrity checks. Captchas & javascript challenges will not be bypassed.**
|
||||||
|
|
||||||
Configuring this lets you fetch images sitting behind Cloudflare and allows you to scrape the **Yep** search engine. Following these instructions might make your package manager unhappy.
|
Configuring this lets you fetch images sitting behind Cloudflare and allows you to scrape the **Yep** & the **Mwmbl** search engines. Please be aware that APT will fight against you and will re-install the openSSL-version of curl constantly when updating.
|
||||||
|
|
||||||
First, follow these instructions. Only install the Firefox modules:
|
First, follow these instructions. Only install the Firefox modules:
|
||||||
|
|
||||||
|
|
185
docs/nginx.md
185
docs/nginx.md
|
@ -1,27 +1,67 @@
|
||||||
# Install on NGINX
|
<h1 align=center>Installation of 4get in NGINX</h1>
|
||||||
|
|
||||||
>I do NOT recommend following this guide, only follow this if you *really* need to use nginx. I recommend you use the apache2 steps instead.
|
<div align=right>
|
||||||
|
|
||||||
Login as root.
|
> NOTE: As the previous version stated, it is better to follow the <a href="https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/apache2.md">Apache2 guide</a> instead of the Nginx one.
|
||||||
|
|
||||||
Create a file in `/etc/nginx/sites-avaliable/` called `4get.conf` or any name you want and put this into the file:
|
> NOTE: This is going to guess that you're using either a <abbr title="(Arch Linux, Artix Linux, Endeavouros, etc...) ">Arch-based system</abbr> or a <abbr title="(Debian, Ubuntu, Devuan, etc...)">Debian-based system</abbr>, although you can still follow it with minor issues.
|
||||||
|
|
||||||
```
|
</div>
|
||||||
server {
|
|
||||||
# DO YOU REALLY NEED TO LOG SEARCHES?
|
1. Login as root.
|
||||||
access_log /dev/null;
|
2. Upgrade your system:
|
||||||
error_log /dev/null;
|
* On Arch-based, run `pacman -Syu`.
|
||||||
# Change this if you have 4get in other folder.
|
* On Debian-based, run `apt update`, then `apt upgrade`.
|
||||||
|
3. Install the following dependencies:
|
||||||
|
* `git`: So you can clone <a href="https://git.lolcat.ca/lolcat/4get">this</a> repository.
|
||||||
|
* `nginx`: So you can run Nginx.
|
||||||
|
* `php-fpm`: This is what allows Nginx to run *(and show)* PHP files.
|
||||||
|
* `php-imagick`, `imagemagick`: Image manipulation.
|
||||||
|
* `php-apcu`: Caching module.
|
||||||
|
* `php-curl`, `curl`: Transferring data with URLs.
|
||||||
|
* `php-mbstring`: String utils.
|
||||||
|
* `certbot`, `certbot-nginx`: ACME client. Used to create SSL certificates.
|
||||||
|
* In Arch-based distributions:
|
||||||
|
* `pacman -S nginx certbot php-imagick certbot-nginx imagemagick curl php-apcu git`
|
||||||
|
* In Debian-based distributions:
|
||||||
|
* `apt install php-mbstring nginx certbot-nginx certbot php-imagick imagemagick php-curl curl php-apcu git`
|
||||||
|
|
||||||
|
<div align=right>
|
||||||
|
|
||||||
|
> IMPORTANT: `php-curl`, `php-mbstring` might be a Debian-only package, but this needs further fact checking.
|
||||||
|
|
||||||
|
> IMPORTANT: If having issues with `php-apcu` or `libsodium`, go to [^1].
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
4. `cd` to `/etc/nginx` and make the `conf.d/` directory if it doesn't exist:
|
||||||
|
* Again, this guesses you're logged in as root.
|
||||||
|
```sh
|
||||||
|
cd /etc/nginx
|
||||||
|
ls -l conf.d/ # If ls shows conf.d, then it means it exists.
|
||||||
|
# If it does not, run:
|
||||||
|
mkdir conf.d
|
||||||
|
```
|
||||||
|
5. Make a file inside `conf.d/` called `4get.conf` and place the following content:
|
||||||
|
* First run `touch conf.d/4get.conf` then `nano conf.d/4get.conf` to open the nano editor: *(Install it if it is not, or use another editor.)*
|
||||||
|
```sh
|
||||||
|
server {
|
||||||
|
access_log /dev/null; # Search log file. Do you really need to?
|
||||||
|
error_log /dev/null; # Error log file.
|
||||||
|
|
||||||
|
# Change this if you have 4get in another folder.
|
||||||
root /var/www/4get;
|
root /var/www/4get;
|
||||||
# Change yourdomain by your domain lol
|
# Change 'yourdomain' to your domain.
|
||||||
server_name www.yourdomain.com yourdomain.com;
|
server_name www.yourdomain.com yourdomain.com;
|
||||||
|
# Port to listen to.
|
||||||
|
listen 80;
|
||||||
|
|
||||||
location @php {
|
location @php {
|
||||||
try_files $uri.php $uri/index.php =404;
|
try_files $uri.php $uri/index.php =404;
|
||||||
# Change the unix socket address if it's different for you.
|
# Change the unix socket address if it's different for you.
|
||||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
# Change this to `fastcgi_params` if you use a debian based distro.
|
# Change this to `fastcgi_params` if you use a debian based distribution.
|
||||||
include fastcgi.conf;
|
include fastcgi.conf;
|
||||||
fastcgi_intercept_errors on;
|
fastcgi_intercept_errors on;
|
||||||
}
|
}
|
||||||
|
@ -34,56 +74,96 @@ server {
|
||||||
return 301 $1;
|
return 301 $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
listen 80;
|
}
|
||||||
}
|
```
|
||||||
```
|
* The above is a very basic configuration and thus will need tweaking to your personal needs. It should still work as-is, though. A 'real world' example is present in [^2].
|
||||||
|
* After saving the file, check that the `nginx.conf` file inside the main directory includes files inside `conf.d/`:
|
||||||
|
* It should be inside the the http block: *(The following is an example! Don't just Copy and Paste it!)*
|
||||||
|
```sh
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
include conf.d/*.conf;
|
||||||
|
types_hash_max_size 4096;
|
||||||
|
# ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
* Now, test your configuration with `nginx -t`, if it says that everything is good, restart *(or start)* the Nginx daemon:
|
||||||
|
* This depends on the init manager, most distributions use `systemd`, but it's better practice to include most.
|
||||||
|
```sh
|
||||||
|
# systemd
|
||||||
|
systemctl stop nginx
|
||||||
|
systemctl start nginxt
|
||||||
|
# or
|
||||||
|
systemctl restart nginx
|
||||||
|
|
||||||
That is a very basic config so you will need to adapt it to your needs in case you have a more complicated nginx configuration. Anyways, you can see a real world example [here](https://git.zzls.xyz/Fijxu/etc-configs/src/branch/selfhost/nginx/sites-available/4get.zzls.xyz.conf)
|
# openrc
|
||||||
|
rc-service nginx stop
|
||||||
|
rc-service nginx start
|
||||||
|
# or
|
||||||
|
rc-service nginx restart
|
||||||
|
|
||||||
After you save the file you will need to do a symlink of the `4get.conf` file to `/etc/nignx/sites-enabled/`, you can do it with this command:
|
# runit
|
||||||
|
sv down nginx
|
||||||
|
sv up nginx
|
||||||
|
# or
|
||||||
|
sv restart nginx
|
||||||
|
|
||||||
```sh
|
# s6
|
||||||
ln -s /etc/nginx/sites-available/4get.conf /etc/nginx/sites-available/4get.conf
|
s6-rc -d change nginx
|
||||||
```
|
s6-rc -u change nginx
|
||||||
|
# or
|
||||||
|
s6-svc -r /run/service/nginx
|
||||||
|
|
||||||
Now test the nginx config with `nginx -t`, if it says that everything is good, restart nginx using `systemctl restart nginx`
|
# dinit
|
||||||
|
dinitctl stop nginx
|
||||||
|
dinitctl start nginx
|
||||||
|
# or
|
||||||
|
dinitctl restart nginx
|
||||||
|
```
|
||||||
|
6. Clone the repository to `/var/www`:
|
||||||
|
* `git clone --depth 1 https://git.lolcat.ca/lolcat/4get 4get` - It clones the repository with the depth of one commit *(so it takes less time to download)* and saves the cloned repository as '4get'.
|
||||||
|
7. That should be it! There are some extra steps you can take, but it really just depends on you.
|
||||||
|
|
||||||
# Encryption setup
|
<h2 align=center>Encryption setup</h2>
|
||||||
|
|
||||||
Generate a certificate for the domain using:
|
1. Generate a certificate for the domain you're using with:
|
||||||
|
* Note that `certbot-nginx` is needed.
|
||||||
|
```sh
|
||||||
|
certbot --nginx --key-type ecdsa -d www.yourdomain.com -d yourdomain.com
|
||||||
|
```
|
||||||
|
2. After that, certbot will deploy the certificate automatically to your 4get conf file; It should be ready to use from there.
|
||||||
|
|
||||||
```sh
|
<h2 align=center>Tor Setup</h2>
|
||||||
certbot --nginx --key-type ecdsa -d www.yourdomain.com -d yourdomain.com
|
|
||||||
```
|
|
||||||
(Remember to install the nginx certbot plugin!!!)
|
|
||||||
|
|
||||||
After doing that certbot should deploy the certificate automatically into your 4get nginx config file. It should be ready to use at that point.
|
<div align=right>
|
||||||
|
|
||||||
# Tor setup on NGINX
|
> IMPORTANT: Tor onion addresses are very long compared to traditional domains, so, Before doing anything, edit `nginx.conf` and increase <abbr title="This setting in your Nginx configuration controls the internal data structure used to manage multiple server names (hostnames) associated with your web server. Each hostname requires a certain amount of memory within this structure. If the size is insufficient, Nginx will encounter errors."><code>server_names_hash_bucket_size</code></abbr> to your needs.
|
||||||
|
|
||||||
Important Note: Tor onion addresses are significantly longer than traditional domain names. Before proceeding with Nginx configuration, ensure you increase the `server_names_hash_bucket_size` value in your `nginx.conf` file. This setting in your Nginx configuration controls the internal data structure used to manage multiple server names (hostnames) associated with your web server. Each hostname requires a certain amount of memory within this structure. If the size is insufficient, Nginx will encounter errors.
|
</div>
|
||||||
|
|
||||||
1. Open your `nginx.conf` file (that is under `/etc/nginx/nginx.conf`).
|
1. `cd` to `/etc/nginx` *(if you haven't)* and open your `nginx.conf` file.
|
||||||
2. Find the line containing `# server_names_hash_bucket_size 64;`.
|
2. Find the line containing `# server_names_hash_bucket_size 64;` inside said file.
|
||||||
3. Uncomment the line and adjust the value. Start with 64, but if you encounter issues, incrementally increase it (e.g., 128, 256) until it accommodates your configuration.
|
3. Uncomment the line and adjust the value; start with 64, but if you encounter issues, incrementally increase it *(e.g., 128, 256)* until it accommodates your configuration.
|
||||||
|
4. Open *(or duplicate the configuration)* and edit it:
|
||||||
|
* Example configuration, again:
|
||||||
|
```sh
|
||||||
|
server {
|
||||||
|
access_log /dev/null; # Search log file. Do you really need to?
|
||||||
|
error_log /dev/null; # Error log file.
|
||||||
|
|
||||||
Open your current 4get NGINX config (that is under `/etc/nginx/sites-available/`) and append this to the end of the file:
|
# Change this if you have 4get in another folder.
|
||||||
|
|
||||||
```
|
|
||||||
server {
|
|
||||||
access_log /dev/null;
|
|
||||||
error_log /dev/null;
|
|
||||||
|
|
||||||
listen 80;
|
|
||||||
server_name <youronionaddress>;
|
|
||||||
root /var/www/4get;
|
root /var/www/4get;
|
||||||
|
# Change 'onionadress.onion' to your onion link.
|
||||||
|
server_name onionadress.onion;
|
||||||
|
# Port to listen to.
|
||||||
|
listen 80;
|
||||||
|
|
||||||
location @php {
|
location @php {
|
||||||
try_files $uri.php $uri/index.php =404;
|
try_files $uri.php $uri/index.php =404;
|
||||||
# Change the unix socket address if it's different for you.
|
# Change the unix socket address if it's different for you.
|
||||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
# Change this to `fastcgi_params` if you use a debian based distro.
|
# Change this to `fastcgi_params` if you use a debian based distribution.
|
||||||
include fastcgi.conf;
|
include fastcgi.conf;
|
||||||
fastcgi_intercept_errors on;
|
fastcgi_intercept_errors on;
|
||||||
}
|
}
|
||||||
|
@ -95,9 +175,20 @@ server {
|
||||||
location ~* ^(.*)\.php$ {
|
location ~* ^(.*)\.php$ {
|
||||||
return 301 $1;
|
return 301 $1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Obviously replace `<youronionaddress>` by the onion address of `/var/lib/tor/4get/hostname` and then check if the nginx config is valid with `nginx -t` if yes, then restart the nginx service and try opening the onion address into the Tor Browser. You can see a real world example [here](https://git.zzls.xyz/Fijxu/etc-configs/src/branch/selfhost/nginx/sites-available/4get.zzls.xyz.conf)
|
}
|
||||||
|
```
|
||||||
|
A real world example is present in [^2].
|
||||||
|
5. Once done, check the configuration with `nginx -t`. If everything's fine and dandy, refer to <a href="https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/tor.md">the Tor guide</a> to setup your onion site.
|
||||||
|
|
||||||
Once you did the above, refer to <a href="https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/tor.md">this tor guide</a> to setup your onionsite.
|
<h2 align=center>Other important things</h2>
|
||||||
|
|
||||||
|
1. <a href="https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/configure.md">Configuration guide</a>: Things to do after setup.
|
||||||
|
2. <a href="https://git.lolcat.ca/lolcat/4get/src/branch/master/docs/apache2.md">Apache2 guide</a>: Fallback to this if you couldn't get something to work, or you don't know something.
|
||||||
|
|
||||||
|
<h2 align=center>Known issues</h2>
|
||||||
|
|
||||||
|
1. https://git.lolcat.ca/lolcat/4get/issues
|
||||||
|
|
||||||
|
[^1]: lolcat/4get#40, If having issues with `libsodium`, or `php-apcu`.
|
||||||
|
[^2]: <a href="https://git.nadeko.net/Fijxu/etc-configs/src/branch/selfhost/nginx/conf.d/4get.conf">git.nadeko.net</a> nadeko.net's 4get instance configuration.
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include "data/config.php";
|
||||||
|
include "lib/frontend.php";
|
||||||
|
$frontend = new frontend();
|
||||||
|
|
||||||
|
echo
|
||||||
|
$frontend->load(
|
||||||
|
"header_nofilters.html",
|
||||||
|
[
|
||||||
|
"title" => "Donate to the project",
|
||||||
|
"class" => " class=\"about\""
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$left =
|
||||||
|
explode(
|
||||||
|
"\n",
|
||||||
|
file_get_contents("template/donate.html")
|
||||||
|
);
|
||||||
|
|
||||||
|
$out = "";
|
||||||
|
|
||||||
|
foreach($left as $line){
|
||||||
|
|
||||||
|
$out .= trim($line);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo
|
||||||
|
$frontend->load(
|
||||||
|
"search.html",
|
||||||
|
[
|
||||||
|
"timetaken" => null,
|
||||||
|
"class" => "",
|
||||||
|
"right-left" => "",
|
||||||
|
"right-right" => "",
|
||||||
|
"left" => $out
|
||||||
|
]
|
||||||
|
);
|
|
@ -89,6 +89,7 @@ class frontend{
|
||||||
$user_agent = "";
|
$user_agent = "";
|
||||||
$bad_header = false;
|
$bad_header = false;
|
||||||
|
|
||||||
|
// block bots that present X-Forwarded-For, Via, etc
|
||||||
foreach($headers_raw as $headerkey => $headervalue){
|
foreach($headers_raw as $headerkey => $headervalue){
|
||||||
|
|
||||||
$headerkey = strtolower($headerkey);
|
$headerkey = strtolower($headerkey);
|
||||||
|
@ -106,12 +107,27 @@ class frontend{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SSL check
|
||||||
|
$bad_ssl = false;
|
||||||
if(
|
if(
|
||||||
|
isset($_SERVER["https"]) &&
|
||||||
|
$_SERVER["https"] == "on" &&
|
||||||
|
isset($_SERVER["SSL_CIPHER"]) &&
|
||||||
|
in_array($_SERVER["SSL_CIPHER"], config::FILTERED_HEADER_KEYS)
|
||||||
|
){
|
||||||
|
|
||||||
|
$bad_ssl = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(
|
||||||
|
$bad_header === true ||
|
||||||
|
$bad_ssl === true ||
|
||||||
|
$user_agent == "" ||
|
||||||
|
// user agent check
|
||||||
preg_match(
|
preg_match(
|
||||||
config::HEADER_REGEX,
|
config::HEADER_REGEX,
|
||||||
$user_agent
|
$user_agent
|
||||||
) ||
|
)
|
||||||
$bad_header === true
|
|
||||||
){
|
){
|
||||||
|
|
||||||
// bot detected !!
|
// bot detected !!
|
||||||
|
@ -923,12 +939,16 @@ class frontend{
|
||||||
"brave" => "Brave",
|
"brave" => "Brave",
|
||||||
"yandex" => "Yandex",
|
"yandex" => "Yandex",
|
||||||
"google" => "Google",
|
"google" => "Google",
|
||||||
|
"google_cse" => "Google CSE",
|
||||||
|
"startpage" => "Startpage",
|
||||||
"qwant" => "Qwant",
|
"qwant" => "Qwant",
|
||||||
|
"ghostery" => "Ghostery",
|
||||||
"yep" => "Yep",
|
"yep" => "Yep",
|
||||||
"greppr" => "Greppr",
|
"greppr" => "Greppr",
|
||||||
"crowdview" => "Crowdview",
|
"crowdview" => "Crowdview",
|
||||||
"mwmbl" => "Mwmbl",
|
"mwmbl" => "Mwmbl",
|
||||||
"mojeek" => "Mojeek",
|
"mojeek" => "Mojeek",
|
||||||
|
"solofield" => "Solofield",
|
||||||
"marginalia" => "Marginalia",
|
"marginalia" => "Marginalia",
|
||||||
"wiby" => "wiby",
|
"wiby" => "wiby",
|
||||||
"curlie" => "Curlie"
|
"curlie" => "Curlie"
|
||||||
|
@ -944,8 +964,11 @@ class frontend{
|
||||||
"yandex" => "Yandex",
|
"yandex" => "Yandex",
|
||||||
"brave" => "Brave",
|
"brave" => "Brave",
|
||||||
"google" => "Google",
|
"google" => "Google",
|
||||||
|
"google_cse" => "Google CSE",
|
||||||
|
"startpage" => "Startpage",
|
||||||
"qwant" => "Qwant",
|
"qwant" => "Qwant",
|
||||||
"yep" => "Yep",
|
"yep" => "Yep",
|
||||||
|
"solofield" => "Solofield",
|
||||||
//"pinterest" => "Pinterest",
|
//"pinterest" => "Pinterest",
|
||||||
"imgur" => "Imgur",
|
"imgur" => "Imgur",
|
||||||
"ftm" => "FindThatMeme"
|
"ftm" => "FindThatMeme"
|
||||||
|
@ -963,7 +986,9 @@ class frontend{
|
||||||
"brave" => "Brave",
|
"brave" => "Brave",
|
||||||
"yandex" => "Yandex",
|
"yandex" => "Yandex",
|
||||||
"google" => "Google",
|
"google" => "Google",
|
||||||
"qwant" => "Qwant"
|
"startpage" => "Startpage",
|
||||||
|
"qwant" => "Qwant",
|
||||||
|
"solofield" => "Solofield"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
@ -975,6 +1000,7 @@ class frontend{
|
||||||
"ddg" => "DuckDuckGo",
|
"ddg" => "DuckDuckGo",
|
||||||
"brave" => "Brave",
|
"brave" => "Brave",
|
||||||
"google" => "Google",
|
"google" => "Google",
|
||||||
|
"startpage" => "Startpage",
|
||||||
"qwant" => "Qwant",
|
"qwant" => "Qwant",
|
||||||
"yep" => "Yep",
|
"yep" => "Yep",
|
||||||
"mojeek" => "Mojeek"
|
"mojeek" => "Mojeek"
|
||||||
|
|
|
@ -381,6 +381,8 @@ class fuckhtml{
|
||||||
$json_out = null;
|
$json_out = null;
|
||||||
$last_char = null;
|
$last_char = null;
|
||||||
|
|
||||||
|
$keyword_check = null;
|
||||||
|
|
||||||
for($i=0; $i<strlen($json); $i++){
|
for($i=0; $i<strlen($json); $i++){
|
||||||
|
|
||||||
switch($json[$i]){
|
switch($json[$i]){
|
||||||
|
@ -396,6 +398,7 @@ class fuckhtml{
|
||||||
|
|
||||||
$bracket = false;
|
$bracket = false;
|
||||||
$is_close_bracket = true;
|
$is_close_bracket = true;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
if($bracket === false){
|
if($bracket === false){
|
||||||
|
@ -429,6 +432,31 @@ class fuckhtml{
|
||||||
$is_close_bracket === false
|
$is_close_bracket === false
|
||||||
){
|
){
|
||||||
|
|
||||||
|
// do keyword check
|
||||||
|
$keyword_check .= $json[$i];
|
||||||
|
|
||||||
|
if(in_array($json[$i], [":", "{"])){
|
||||||
|
|
||||||
|
$keyword_check = substr($keyword_check, 0, -1);
|
||||||
|
|
||||||
|
if(
|
||||||
|
preg_match(
|
||||||
|
'/function|array|return/i',
|
||||||
|
$keyword_check
|
||||||
|
)
|
||||||
|
){
|
||||||
|
|
||||||
|
$json_out =
|
||||||
|
preg_replace(
|
||||||
|
'/[{"]*' . preg_quote($keyword_check, "/") . '$/',
|
||||||
|
"",
|
||||||
|
$json_out
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$keyword_check = null;
|
||||||
|
}
|
||||||
|
|
||||||
// here we know we're not iterating over a quoted string
|
// here we know we're not iterating over a quoted string
|
||||||
switch($json[$i]){
|
switch($json[$i]){
|
||||||
|
|
||||||
|
|
666
license.txt
666
license.txt
|
@ -1,13 +1,661 @@
|
||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
Version 2, December 2004
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
Copyright (C) 2023 lolcat <will@lolcat.ca>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim or modified
|
Preamble
|
||||||
copies of this license document, and changing it is allowed as long
|
|
||||||
as the name is changed.
|
|
||||||
|
|
||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
|
@ -293,8 +293,8 @@ class brave{
|
||||||
/*
|
/*
|
||||||
$handle = fopen("scraper/brave.html", "r");
|
$handle = fopen("scraper/brave.html", "r");
|
||||||
$html = fread($handle, filesize("scraper/brave.html"));
|
$html = fread($handle, filesize("scraper/brave.html"));
|
||||||
fclose($handle);
|
fclose($handle);*/
|
||||||
*/
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$html =
|
$html =
|
||||||
|
@ -410,10 +410,20 @@ class brave{
|
||||||
throw new Exception("Could not grep JavaScript object");
|
throw new Exception("Could not grep JavaScript object");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data =
|
||||||
|
rtrim(
|
||||||
|
preg_replace(
|
||||||
|
'/\(Array\(0\)\)\).*$/',
|
||||||
|
"",
|
||||||
|
$grep[1]
|
||||||
|
),
|
||||||
|
" ]"
|
||||||
|
) . "]";
|
||||||
|
|
||||||
$data =
|
$data =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->parseJsObject(
|
->parseJsObject(
|
||||||
$grep[1]
|
$data
|
||||||
);
|
);
|
||||||
unset($grep);
|
unset($grep);
|
||||||
|
|
||||||
|
@ -663,7 +673,10 @@ class brave{
|
||||||
$table["Address"] = $result["location"]["postal_address"]["displayAddress"];
|
$table["Address"] = $result["location"]["postal_address"]["displayAddress"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($result["location"]["rating"])){
|
if(
|
||||||
|
isset($result["location"]["rating"]) &&
|
||||||
|
$result["location"]["rating"] != "void 0"
|
||||||
|
){
|
||||||
|
|
||||||
$table["Rating"] =
|
$table["Rating"] =
|
||||||
$result["location"]["rating"]["ratingValue"] . "/" .
|
$result["location"]["rating"]["ratingValue"] . "/" .
|
||||||
|
@ -671,13 +684,19 @@ class brave{
|
||||||
number_format($result["location"]["rating"]["reviewCount"]) . " votes)";
|
number_format($result["location"]["rating"]["reviewCount"]) . " votes)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($result["location"]["contact"]["telephone"])){
|
if(
|
||||||
|
isset($result["location"]["contact"]["telephone"]) &&
|
||||||
|
$result["location"]["contact"]["telephone"] != "void 0"
|
||||||
|
){
|
||||||
|
|
||||||
$table["Phone number"] =
|
$table["Phone number"] =
|
||||||
$result["location"]["contact"]["telephone"];
|
$result["location"]["contact"]["telephone"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($result["location"]["price_range"])){
|
if(
|
||||||
|
isset($result["location"]["price_range"]) &&
|
||||||
|
$result["location"]["price_range"] != "void 0"
|
||||||
|
){
|
||||||
|
|
||||||
$table["Price"] =
|
$table["Price"] =
|
||||||
$result["location"]["price_range"];
|
$result["location"]["price_range"];
|
||||||
|
|
|
@ -28,6 +28,9 @@ class ddg{
|
||||||
|
|
||||||
curl_setopt($curlproc, CURLOPT_URL, $url);
|
curl_setopt($curlproc, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
// http2 bypass
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
||||||
|
|
||||||
switch($reqtype){
|
switch($reqtype){
|
||||||
case self::req_web:
|
case self::req_web:
|
||||||
$headers =
|
$headers =
|
||||||
|
@ -36,27 +39,33 @@ class ddg{
|
||||||
"Accept-Encoding: gzip",
|
"Accept-Encoding: gzip",
|
||||||
"Accept-Language: en-US,en;q=0.5",
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
"DNT: 1",
|
"DNT: 1",
|
||||||
|
"Sec-GPC: 1",
|
||||||
"Connection: keep-alive",
|
"Connection: keep-alive",
|
||||||
"Upgrade-Insecure-Requests: 1",
|
"Upgrade-Insecure-Requests: 1",
|
||||||
"Sec-Fetch-Dest: document",
|
"Sec-Fetch-Dest: document",
|
||||||
"Sec-Fetch-Mode: navigate",
|
"Sec-Fetch-Mode: navigate",
|
||||||
"Sec-Fetch-Site: cross-site",
|
"Sec-Fetch-Site: same-origin",
|
||||||
"Upgrade-Insecure-Requests: 1"];
|
"Sec-Fetch-User: ?1",
|
||||||
|
"Priority: u=0, i",
|
||||||
|
"TE: trailers"];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::req_xhr:
|
case self::req_xhr:
|
||||||
$headers =
|
$headers =
|
||||||
["User-Agent: " . config::USER_AGENT,
|
["User-Agent: " . config::USER_AGENT,
|
||||||
"Accept: */*",
|
"Accept: application/json, text/javascript, */*; q=0.01",
|
||||||
"Accept-Encoding: gzip",
|
"Accept-Encoding: gzip",
|
||||||
"Accept-Language: en-US,en;q=0.5",
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
"Connection: keep-alive",
|
"Connection: keep-alive",
|
||||||
"Referer: https://duckduckgo.com/",
|
"Referer: https://duckduckgo.com/",
|
||||||
"X-Requested-With: XMLHttpRequest",
|
"X-Requested-With: XMLHttpRequest",
|
||||||
"DNT: 1",
|
"DNT: 1",
|
||||||
"Sec-Fetch-Dest: script",
|
"Sec-GPC: 1",
|
||||||
"Sec-Fetch-Mode: no-cors",
|
"Connection: keep-alive",
|
||||||
"Sec-Fetch-Site: same-site"];
|
"Sec-Fetch-Dest: empty",
|
||||||
|
"Sec-Fetch-Mode: cors",
|
||||||
|
"Sec-Fetch-Site: same-origin",
|
||||||
|
"TE: trailers"];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1889,12 +1898,12 @@ class ddg{
|
||||||
[$npt, $proxy] = $this->backend->get($get["npt"], "images");
|
[$npt, $proxy] = $this->backend->get($get["npt"], "images");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$json = json_decode($this->get(
|
$json = $this->get(
|
||||||
$proxy,
|
$proxy,
|
||||||
"https://duckduckgo.com/i.js?" . $npt,
|
"https://duckduckgo.com/i.js?" . $npt,
|
||||||
[],
|
[],
|
||||||
ddg::req_xhr
|
ddg::req_xhr
|
||||||
), true);
|
);
|
||||||
|
|
||||||
}catch(Exception $err){
|
}catch(Exception $err){
|
||||||
|
|
||||||
|
@ -1920,6 +1929,7 @@ class ddg{
|
||||||
|
|
||||||
$filter = [];
|
$filter = [];
|
||||||
$get_filters = [
|
$get_filters = [
|
||||||
|
"hps" => "1",
|
||||||
"q" => $search,
|
"q" => $search,
|
||||||
"iax" => "images",
|
"iax" => "images",
|
||||||
"ia" => "images"
|
"ia" => "images"
|
||||||
|
@ -1994,12 +2004,12 @@ class ddg{
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$json = json_decode($this->get(
|
$json = $this->get(
|
||||||
$proxy,
|
$proxy,
|
||||||
"https://duckduckgo.com/i.js",
|
"https://duckduckgo.com/i.js",
|
||||||
$js_params,
|
$js_params,
|
||||||
ddg::req_xhr
|
ddg::req_xhr
|
||||||
), true);
|
);
|
||||||
|
|
||||||
}catch(Exception $err){
|
}catch(Exception $err){
|
||||||
|
|
||||||
|
@ -2007,6 +2017,13 @@ class ddg{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$json = json_decode($json, true);
|
||||||
|
|
||||||
|
if($json === null){
|
||||||
|
|
||||||
|
throw new Exception("Failed to decode JSON");
|
||||||
|
}
|
||||||
|
|
||||||
$out = [
|
$out = [
|
||||||
"status" => "ok",
|
"status" => "ok",
|
||||||
"npt" => null,
|
"npt" => null,
|
||||||
|
|
|
@ -0,0 +1,320 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class ghostery{
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
|
||||||
|
include "lib/backend.php";
|
||||||
|
$this->backend = new backend("ghostery");
|
||||||
|
|
||||||
|
include "lib/fuckhtml.php";
|
||||||
|
$this->fuckhtml = new fuckhtml();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getfilters($page){
|
||||||
|
|
||||||
|
if($page != "web"){
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
"country" => [
|
||||||
|
"display" => "Country",
|
||||||
|
"option" => [
|
||||||
|
"any" => "All regions",
|
||||||
|
"AR" => "Argentina",
|
||||||
|
"AU" => "Australia",
|
||||||
|
"AT" => "Austria",
|
||||||
|
"BE" => "Belgium",
|
||||||
|
"BR" => "Brazil",
|
||||||
|
"CA" => "Canada",
|
||||||
|
"CL" => "Chile",
|
||||||
|
"DK" => "Denmark",
|
||||||
|
"FI" => "Finland",
|
||||||
|
"FR" => "France",
|
||||||
|
"DE" => "Germany",
|
||||||
|
"HK" => "Hong Kong",
|
||||||
|
"IN" => "India",
|
||||||
|
"ID" => "Indonesia",
|
||||||
|
"IT" => "Italy",
|
||||||
|
"JP" => "Japan",
|
||||||
|
"KR" => "Korea",
|
||||||
|
"MY" => "Malaysia",
|
||||||
|
"MX" => "Mexico",
|
||||||
|
"NL" => "Netherlands",
|
||||||
|
"NZ" => "New Zealand",
|
||||||
|
"NO" => "Norway",
|
||||||
|
"CN" => "People's Republic of China",
|
||||||
|
"PL" => "Poland",
|
||||||
|
"PT" => "Portugal",
|
||||||
|
"PH" => "Republic of the Philippines",
|
||||||
|
"RU" => "Russia",
|
||||||
|
"SA" => "Saudi Arabia",
|
||||||
|
"ZA" => "South Africa",
|
||||||
|
"ES" => "Spain",
|
||||||
|
"SE" => "Sweden",
|
||||||
|
"CH" => "Switzerland",
|
||||||
|
"TW" => "Taiwan",
|
||||||
|
"TR" => "Turkey",
|
||||||
|
"GB" => "United Kingdom",
|
||||||
|
"US" => "United States"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function get($proxy, $url, $get = [], $country){
|
||||||
|
|
||||||
|
$curlproc = curl_init();
|
||||||
|
|
||||||
|
if($get !== []){
|
||||||
|
$get = http_build_query($get);
|
||||||
|
$url .= "?" . $get;
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
||||||
|
["User-Agent: " . config::USER_AGENT,
|
||||||
|
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||||
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
|
"Accept-Encoding: gzip",
|
||||||
|
"Referer: https://ghosterysearch.com",
|
||||||
|
"DNT: 1",
|
||||||
|
"Sec-GPC: 1",
|
||||||
|
"Connection: keep-alive",
|
||||||
|
"Cookie: ctry=" . ($country == "any" ? "--" : $country) . "; noads=true",
|
||||||
|
"Upgrade-Insecure-Requests: 1",
|
||||||
|
"Sec-Fetch-Dest: document",
|
||||||
|
"Sec-Fetch-Mode: navigate",
|
||||||
|
"Sec-Fetch-Site: same-origin",
|
||||||
|
"Sec-Fetch-User: ?1",
|
||||||
|
"Priority: u=0, i"]
|
||||||
|
);
|
||||||
|
|
||||||
|
// http2 bypass
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYHOST, 2);
|
||||||
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYPEER, true);
|
||||||
|
curl_setopt($curlproc, CURLOPT_CONNECTTIMEOUT, 30);
|
||||||
|
curl_setopt($curlproc, CURLOPT_TIMEOUT, 30);
|
||||||
|
|
||||||
|
$this->backend->assign_proxy($curlproc, $proxy);
|
||||||
|
|
||||||
|
$data = curl_exec($curlproc);
|
||||||
|
|
||||||
|
if(curl_errno($curlproc)){
|
||||||
|
|
||||||
|
throw new Exception(curl_error($curlproc));
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_close($curlproc);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function web($get){
|
||||||
|
|
||||||
|
if($get["npt"]){
|
||||||
|
|
||||||
|
[$query, $proxy] = $this->backend->get($get["npt"], "web");
|
||||||
|
|
||||||
|
parse_str($query, $query);
|
||||||
|
|
||||||
|
// country
|
||||||
|
$country = $query["c"];
|
||||||
|
unset($query["c"]);
|
||||||
|
|
||||||
|
$query = http_build_query($query);
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://ghosterysearch.com/search?" . $query,
|
||||||
|
[],
|
||||||
|
$country
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch search page");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$proxy = $this->backend->get_ip();
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://ghosterysearch.com/search",
|
||||||
|
[
|
||||||
|
"q" => $get["s"]
|
||||||
|
],
|
||||||
|
$get["country"]
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch search page");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = [
|
||||||
|
"status" => "ok",
|
||||||
|
"spelling" => [
|
||||||
|
"type" => "no_correction",
|
||||||
|
"using" => null,
|
||||||
|
"correction" => null
|
||||||
|
],
|
||||||
|
"npt" => null,
|
||||||
|
"answer" => [],
|
||||||
|
"web" => [],
|
||||||
|
"image" => [],
|
||||||
|
"video" => [],
|
||||||
|
"news" => [],
|
||||||
|
"related" => []
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$results_wrapper =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"results",
|
||||||
|
"section"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($results_wrapper) === 0){
|
||||||
|
|
||||||
|
throw new Exception("Failed to grep result section");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fuckhtml->load($results_wrapper[0]);
|
||||||
|
|
||||||
|
// get search results
|
||||||
|
$results =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"result",
|
||||||
|
"li"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($results) === 0){
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($results as $result){
|
||||||
|
|
||||||
|
$this->fuckhtml->load($result);
|
||||||
|
|
||||||
|
$a =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"url",
|
||||||
|
"a"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($a) === 0){
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$a = $a[0];
|
||||||
|
|
||||||
|
$out["web"][] = [
|
||||||
|
"title" =>
|
||||||
|
$this->titledots(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"h2"
|
||||||
|
)[0]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"description" =>
|
||||||
|
$this->titledots(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"p"
|
||||||
|
)[0]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"url" =>
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$a
|
||||||
|
["attributes"]
|
||||||
|
["href"]
|
||||||
|
),
|
||||||
|
"date" => null,
|
||||||
|
"type" => "web",
|
||||||
|
"thumb" => [
|
||||||
|
"url" => null,
|
||||||
|
"ratio" => null
|
||||||
|
],
|
||||||
|
"sublink" => [],
|
||||||
|
"table" => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
// get pagination token
|
||||||
|
$pagination_wrapper =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"pagination",
|
||||||
|
"div"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($pagination_wrapper) !== 0){
|
||||||
|
|
||||||
|
// found next page!
|
||||||
|
$this->fuckhtml->load($pagination_wrapper[0]);
|
||||||
|
|
||||||
|
$a =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"a"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($a) !== 0){
|
||||||
|
|
||||||
|
$q =
|
||||||
|
parse_url(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$a[count($a) - 1]
|
||||||
|
["attributes"]
|
||||||
|
["href"]
|
||||||
|
),
|
||||||
|
PHP_URL_QUERY
|
||||||
|
);
|
||||||
|
|
||||||
|
$out["npt"] =
|
||||||
|
$this->backend
|
||||||
|
->store(
|
||||||
|
$q . "&c=" . $get["country"],
|
||||||
|
"web",
|
||||||
|
$proxy
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function titledots($title){
|
||||||
|
|
||||||
|
return trim($title, " .\t\n\r\0\x0B…");
|
||||||
|
}
|
||||||
|
}
|
|
@ -703,6 +703,43 @@ class google{
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
|
$this->fuckhtml->load($result_div);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
// get the "Did you mean?" prompt
|
||||||
|
$taw =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementById(
|
||||||
|
"taw"
|
||||||
|
);
|
||||||
|
|
||||||
|
if($taw){
|
||||||
|
|
||||||
|
$this->fuckhtml->load($taw);
|
||||||
|
|
||||||
|
$as =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"a"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($as) !== 0){
|
||||||
|
|
||||||
|
$text =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$as[0]
|
||||||
|
);
|
||||||
|
|
||||||
|
// @TODO implement did_you_mean
|
||||||
|
$out["spelling"] = [
|
||||||
|
"type" => "including",
|
||||||
|
"using" => $search,
|
||||||
|
"correction" => $text
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->fuckhtml->load($result_div);
|
$this->fuckhtml->load($result_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,6 +799,41 @@ class google{
|
||||||
$title = "Notice";
|
$title = "Notice";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$div =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"div"
|
||||||
|
);
|
||||||
|
|
||||||
|
// probe for related searches div, if found, ignore it cause its shit
|
||||||
|
$probe =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByAttributeValue(
|
||||||
|
"role",
|
||||||
|
"list",
|
||||||
|
$div
|
||||||
|
);
|
||||||
|
|
||||||
|
// also probe for children
|
||||||
|
if(count($probe) === 0){
|
||||||
|
|
||||||
|
$probe =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
$this->getstyle(
|
||||||
|
[
|
||||||
|
"flex-shrink" => "0",
|
||||||
|
"-moz-box-flex" => "0",
|
||||||
|
"flex-grow" => "0",
|
||||||
|
"overflow" => "hidden"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
$div
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($probe) === 0){
|
||||||
|
|
||||||
$description = [];
|
$description = [];
|
||||||
|
|
||||||
$as =
|
$as =
|
||||||
|
@ -855,23 +927,6 @@ class google{
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
// @TODO: Check if this ever gets populated without giving me garbage
|
|
||||||
/*
|
|
||||||
$text =
|
|
||||||
$this->fuckhtml
|
|
||||||
->getTextContent(
|
|
||||||
$card
|
|
||||||
);
|
|
||||||
|
|
||||||
if($text != ""){
|
|
||||||
$description[] = [
|
|
||||||
"type" => "text",
|
|
||||||
"value" => $text
|
|
||||||
];
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($description) !== 0){
|
if(count($description) !== 0){
|
||||||
|
@ -886,6 +941,7 @@ class google{
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
@ -895,36 +951,10 @@ class google{
|
||||||
// get "Related Searches" and "People also search for"
|
// get "Related Searches" and "People also search for"
|
||||||
//
|
//
|
||||||
$relateds =
|
$relateds =
|
||||||
array_merge(
|
|
||||||
$this->fuckhtml
|
|
||||||
->getElementsByClassName(
|
|
||||||
$this->getstyle(
|
|
||||||
[
|
|
||||||
"align-items" => "center",
|
|
||||||
"background-color" => "#28292a",
|
|
||||||
"border-radius" => "100px",
|
|
||||||
"box-sizing" => "border-box",
|
|
||||||
"display" => "flex",
|
|
||||||
"max-height" => "none",
|
|
||||||
"min-height" => "48px",
|
|
||||||
"padding-left" => "17px",
|
|
||||||
"padding-right" => "17px",
|
|
||||||
"position" => "relative"
|
|
||||||
]
|
|
||||||
) . " " .
|
|
||||||
$this->getstyle(
|
|
||||||
[
|
|
||||||
"margin-left" => "8px",
|
|
||||||
"margin-right" => "8px"
|
|
||||||
]
|
|
||||||
),
|
|
||||||
"a"
|
|
||||||
),
|
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByClassName(
|
->getElementsByClassName(
|
||||||
"wyccme",
|
"wyccme",
|
||||||
"div"
|
"div"
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($relateds as $related){
|
foreach($relateds as $related){
|
||||||
|
@ -1354,7 +1384,7 @@ class google{
|
||||||
"font-size" => "12px",
|
"font-size" => "12px",
|
||||||
"line-height" => "1.34",
|
"line-height" => "1.34",
|
||||||
"display" => "inline-block",
|
"display" => "inline-block",
|
||||||
"font-family" => "Google Sans,arial,sans-serif",
|
"font-family" => "google sans,arial,sans-serif",
|
||||||
"padding-right" => "0",
|
"padding-right" => "0",
|
||||||
"white-space" => "nowrap"
|
"white-space" => "nowrap"
|
||||||
]
|
]
|
||||||
|
@ -1401,7 +1431,7 @@ class google{
|
||||||
"line-height" => "22px",
|
"line-height" => "22px",
|
||||||
"overflow" => "hidden",
|
"overflow" => "hidden",
|
||||||
"word-break" => "break-word",
|
"word-break" => "break-word",
|
||||||
"color" => "#bdc1c6"
|
"color" => "#4d5156"
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
"div"
|
"div"
|
||||||
|
@ -1415,12 +1445,9 @@ class google{
|
||||||
->getElementsByClassName(
|
->getElementsByClassName(
|
||||||
$this->getstyle(
|
$this->getstyle(
|
||||||
[
|
[
|
||||||
"border-radius" => "10px",
|
"background-color" => "rgba(0,0,0,0.6)",
|
||||||
"font-family" => "arial,sans-serif-medium,sans-serif",
|
"color" => "#fff",
|
||||||
"font-size" => "12px",
|
"fill" => "#fff"
|
||||||
"line-height" => "16px",
|
|
||||||
"padding-block" => "2px",
|
|
||||||
"padding-inline" => "8px"
|
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
"div"
|
"div"
|
||||||
|
@ -1433,14 +1460,6 @@ class google{
|
||||||
->getTextContent(
|
->getTextContent(
|
||||||
$duration[0]
|
$duration[0]
|
||||||
);
|
);
|
||||||
|
|
||||||
// remove duration from description
|
|
||||||
$description[0]["innerHTML"] =
|
|
||||||
str_replace(
|
|
||||||
$duration[0]["outerHTML"],
|
|
||||||
"",
|
|
||||||
$description[0]["innerHTML"]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$web["description"] =
|
$web["description"] =
|
||||||
|
@ -1979,7 +1998,7 @@ class google{
|
||||||
"font-size" => "12px",
|
"font-size" => "12px",
|
||||||
"line-height" => "1.34",
|
"line-height" => "1.34",
|
||||||
"display" => "inline-block",
|
"display" => "inline-block",
|
||||||
"font-family" => "Google Sans,arial,sans-serif",
|
"font-family" => "google sans,arial,sans-serif",
|
||||||
"padding-right" => "0",
|
"padding-right" => "0",
|
||||||
"white-space" => "nowrap"
|
"white-space" => "nowrap"
|
||||||
]
|
]
|
||||||
|
@ -2211,7 +2230,7 @@ class google{
|
||||||
->getElementsByClassName(
|
->getElementsByClassName(
|
||||||
$this->getstyle(
|
$this->getstyle(
|
||||||
[
|
[
|
||||||
"font-family" => "Google Sans,arial,sans-serif",
|
"font-family" => "google sans,arial,sans-serif",
|
||||||
"font-size" => "28px",
|
"font-size" => "28px",
|
||||||
"line-height" => "36px"
|
"line-height" => "36px"
|
||||||
]
|
]
|
||||||
|
@ -2451,6 +2470,7 @@ class google{
|
||||||
$this->getstyle(
|
$this->getstyle(
|
||||||
[
|
[
|
||||||
"outline-offset" => "-1px",
|
"outline-offset" => "-1px",
|
||||||
|
"outline-width" => "1px",
|
||||||
"display" => "flex",
|
"display" => "flex",
|
||||||
"flex-direction" => "column",
|
"flex-direction" => "column",
|
||||||
"flex-grow" => "1"
|
"flex-grow" => "1"
|
||||||
|
@ -2801,7 +2821,22 @@ class google{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get thumbnail
|
// get heading element
|
||||||
|
$heading =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByAttributeValue(
|
||||||
|
"role",
|
||||||
|
"heading",
|
||||||
|
"div"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($heading) === 0){
|
||||||
|
|
||||||
|
// no heading, fuck this.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get thumbnail before loading heading object
|
||||||
$image =
|
$image =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByAttributeName(
|
->getElementsByAttributeName(
|
||||||
|
@ -2823,35 +2858,6 @@ class google{
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// get title
|
|
||||||
$title =
|
|
||||||
$this->fuckhtml
|
|
||||||
->getElementsByClassName(
|
|
||||||
$this->getstyle(
|
|
||||||
[
|
|
||||||
"font-family" => "arial,sans-serif",
|
|
||||||
"font-size" => "16px",
|
|
||||||
"font-weight" => "400",
|
|
||||||
"line-height" => "24px"
|
|
||||||
]
|
|
||||||
),
|
|
||||||
"div"
|
|
||||||
);
|
|
||||||
|
|
||||||
if(count($title) === 0){
|
|
||||||
|
|
||||||
// ?? no title
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$title =
|
|
||||||
$this->titledots(
|
|
||||||
$this->fuckhtml
|
|
||||||
->getTextContent(
|
|
||||||
$title[0]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// get duration
|
// get duration
|
||||||
$duration_div =
|
$duration_div =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
|
@ -2908,6 +2914,38 @@ class google{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// load heading
|
||||||
|
$this->fuckhtml->load($heading[0]);
|
||||||
|
|
||||||
|
// get title
|
||||||
|
$title =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
$this->getstyle(
|
||||||
|
[
|
||||||
|
"font-family" => "arial,sans-serif",
|
||||||
|
"font-size" => "16px",
|
||||||
|
"font-weight" => "400",
|
||||||
|
"line-height" => "24px"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
"div"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($title) === 0){
|
||||||
|
|
||||||
|
// ?? no title
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title =
|
||||||
|
$this->titledots(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$title[0]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// get date
|
// get date
|
||||||
$date_div =
|
$date_div =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
|
@ -3940,7 +3978,7 @@ class google{
|
||||||
for($k=0; $k<count($values_regex[1]); $k++){
|
for($k=0; $k<count($values_regex[1]); $k++){
|
||||||
|
|
||||||
$values[trim($values_regex[1][$k])] =
|
$values[trim($values_regex[1][$k])] =
|
||||||
trim($values_regex[2][$k]);
|
strtolower(trim($values_regex[2][$k]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$names = explode(",", $matches[1][$i]);
|
$names = explode(",", $matches[1][$i]);
|
||||||
|
@ -3971,7 +4009,7 @@ class google{
|
||||||
|
|
||||||
foreach($this->styles[":root"] as $key => $value){
|
foreach($this->styles[":root"] as $key => $value){
|
||||||
|
|
||||||
$this->css_colors[$value] = $key;
|
$this->css_colors[$value] = strtolower($key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4120,7 +4158,7 @@ class google{
|
||||||
|
|
||||||
if($get["npt"]){
|
if($get["npt"]){
|
||||||
|
|
||||||
[$params, $proxy] = $this->backend->get($get["npt"], "web");
|
[$params, $proxy] = $this->backend->get($get["npt"], "video");
|
||||||
$params = json_decode($params, true);
|
$params = json_decode($params, true);
|
||||||
|
|
||||||
$search = $params["q"];
|
$search = $params["q"];
|
||||||
|
@ -4206,7 +4244,7 @@ class google{
|
||||||
throw new Exception("Failed to get HTML");
|
throw new Exception("Failed to get HTML");
|
||||||
}
|
}
|
||||||
|
|
||||||
//$html = file_get_contents("scraper/google-video.html");
|
//$html = file_get_contents("scraper/google.html");
|
||||||
|
|
||||||
$response = $this->parsepage($html, "videos", $search, $proxy, $params);
|
$response = $this->parsepage($html, "videos", $search, $proxy, $params);
|
||||||
$out = [
|
$out = [
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -298,9 +298,8 @@ class greppr{
|
||||||
|
|
||||||
$description =
|
$description =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByFuzzyAttributeValue(
|
->getElementsByClassName(
|
||||||
"style",
|
"highlightedDesc",
|
||||||
"color:#777777;",
|
|
||||||
"p"
|
"p"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -310,9 +309,11 @@ class greppr{
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$description =
|
$description =
|
||||||
|
$this->limitstrlen(
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getTextContent(
|
->getTextContent(
|
||||||
$description[0]
|
$description[0]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +326,7 @@ class greppr{
|
||||||
$date =
|
$date =
|
||||||
strtotime(
|
strtotime(
|
||||||
explode(
|
explode(
|
||||||
"Added:",
|
":",
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getTextContent(
|
->getTextContent(
|
||||||
$date[count($date) - 1]["innerHTML"]
|
$date[count($date) - 1]["innerHTML"]
|
||||||
|
@ -426,4 +427,9 @@ class greppr{
|
||||||
|
|
||||||
return $tokens;
|
return $tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function limitstrlen($text){
|
||||||
|
|
||||||
|
return explode("\n", wordwrap($text, 300, "\n"))[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,7 @@ class marginalia{
|
||||||
"related" => []
|
"related" => []
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// API scraper
|
||||||
if(config::MARGINALIA_API_KEY !== null){
|
if(config::MARGINALIA_API_KEY !== null){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
@ -263,7 +264,29 @@ class marginalia{
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no more cloudflare!! Parse html by default
|
// HTML parser
|
||||||
|
$proxy = $this->backend->get_ip();
|
||||||
|
|
||||||
|
if($get["npt"]){
|
||||||
|
|
||||||
|
[$params, $proxy] =
|
||||||
|
$this->backend->get(
|
||||||
|
$get["npt"],
|
||||||
|
"web"
|
||||||
|
);
|
||||||
|
|
||||||
|
try{
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://search.marginalia.nu/search?" . $params
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to get HTML");
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
$params = [
|
$params = [
|
||||||
"query" => $search
|
"query" => $search
|
||||||
];
|
];
|
||||||
|
@ -284,7 +307,7 @@ class marginalia{
|
||||||
try{
|
try{
|
||||||
$html =
|
$html =
|
||||||
$this->get(
|
$this->get(
|
||||||
$this->backend->get_ip(),
|
$proxy,
|
||||||
"https://search.marginalia.nu/search",
|
"https://search.marginalia.nu/search",
|
||||||
$params
|
$params
|
||||||
);
|
);
|
||||||
|
@ -292,6 +315,7 @@ class marginalia{
|
||||||
|
|
||||||
throw new Exception("Failed to get HTML");
|
throw new Exception("Failed to get HTML");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
@ -387,6 +411,65 @@ class marginalia{
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get next page
|
||||||
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$pagination =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByAttributeValue(
|
||||||
|
"aria-label",
|
||||||
|
"pagination",
|
||||||
|
"nav"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($pagination) === 0){
|
||||||
|
|
||||||
|
// no pagination
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fuckhtml->load($pagination[0]);
|
||||||
|
|
||||||
|
$pages =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"page-link",
|
||||||
|
"a"
|
||||||
|
);
|
||||||
|
|
||||||
|
$found_current_page = false;
|
||||||
|
|
||||||
|
foreach($pages as $page){
|
||||||
|
|
||||||
|
if(
|
||||||
|
stripos(
|
||||||
|
$page["attributes"]["class"],
|
||||||
|
"active"
|
||||||
|
) !== false
|
||||||
|
){
|
||||||
|
|
||||||
|
$found_current_page = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($found_current_page){
|
||||||
|
|
||||||
|
// we found current page index, and we iterated over
|
||||||
|
// the next page <a>
|
||||||
|
|
||||||
|
$out["npt"] =
|
||||||
|
$this->backend->store(
|
||||||
|
parse_url(
|
||||||
|
$page["attributes"]["href"],
|
||||||
|
PHP_URL_QUERY
|
||||||
|
),
|
||||||
|
"web",
|
||||||
|
$proxy
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -701,9 +701,11 @@ class mojeek{
|
||||||
if(count($thumb) === 2){
|
if(count($thumb) === 2){
|
||||||
|
|
||||||
$answer["thumb"] =
|
$answer["thumb"] =
|
||||||
|
urldecode(
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getTextContent(
|
->getTextContent(
|
||||||
$thumb[1]
|
$thumb[1]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,18 +27,24 @@ class mwmbl{
|
||||||
|
|
||||||
curl_setopt($curlproc, CURLOPT_URL, $url);
|
curl_setopt($curlproc, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
// use http2
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
||||||
|
|
||||||
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
||||||
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
||||||
["User-Agent: " . config::USER_AGENT,
|
["User-Agent: " . config::USER_AGENT,
|
||||||
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||||
"Accept-Language: en-US,en;q=0.5",
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
"Accept-Encoding: gzip",
|
"Accept-Encoding: gzip",
|
||||||
|
"Referer: https://beta.mwmbl.org/",
|
||||||
"DNT: 1",
|
"DNT: 1",
|
||||||
|
"Sec-GPC: 1",
|
||||||
"Connection: keep-alive",
|
"Connection: keep-alive",
|
||||||
"Upgrade-Insecure-Requests: 1",
|
"Upgrade-Insecure-Requests: 1",
|
||||||
"Sec-Fetch-Dest: document",
|
"Sec-Fetch-Dest: document",
|
||||||
"Sec-Fetch-Mode: navigate",
|
"Sec-Fetch-Mode: navigate",
|
||||||
"Sec-Fetch-Site: none",
|
"Sec-Fetch-Site: same-origin",
|
||||||
|
"Priority: u=0, i",
|
||||||
"Sec-Fetch-User: ?1"]
|
"Sec-Fetch-User: ?1"]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -72,14 +78,14 @@ class mwmbl{
|
||||||
try{
|
try{
|
||||||
$html = $this->get(
|
$html = $this->get(
|
||||||
$this->backend->get_ip(), // no next page!
|
$this->backend->get_ip(), // no next page!
|
||||||
"https://mwmbl.org/app/home/",
|
"https://beta.mwmbl.org/",
|
||||||
[
|
[
|
||||||
"q" => $search
|
"q" => $search
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}catch(Exception $error){
|
}catch(Exception $error){
|
||||||
|
|
||||||
throw new Exception("Failed to fetch HTML");
|
throw new Exception("Failed to fetch HTML. If you're getting a timeout, make sure you have curl-impersonate setup.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = [
|
$out = [
|
||||||
|
@ -115,6 +121,68 @@ class mwmbl{
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByTagName("p");
|
->getElementsByTagName("p");
|
||||||
|
|
||||||
|
$sublinks = [];
|
||||||
|
|
||||||
|
$mores =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"result-link-more",
|
||||||
|
"div"
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($mores as $more){
|
||||||
|
|
||||||
|
$this->fuckhtml->load($more);
|
||||||
|
|
||||||
|
$as =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"more",
|
||||||
|
"a"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($as) === 0){
|
||||||
|
|
||||||
|
// ?? invalid
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sublinks[] = [
|
||||||
|
"title" =>
|
||||||
|
$this->titledots(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"more-title",
|
||||||
|
"span"
|
||||||
|
)[0]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"description" =>
|
||||||
|
$this->titledots(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"more-extract",
|
||||||
|
"span"
|
||||||
|
)[0]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"url" =>
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$as[0]
|
||||||
|
["attributes"]
|
||||||
|
["href"]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset
|
||||||
|
$this->fuckhtml->load($result);
|
||||||
|
|
||||||
$out["web"][] = [
|
$out["web"][] = [
|
||||||
"title" =>
|
"title" =>
|
||||||
$this->titledots(
|
$this->titledots(
|
||||||
|
@ -153,7 +221,7 @@ class mwmbl{
|
||||||
"url" => null,
|
"url" => null,
|
||||||
"ratio" => null
|
"ratio" => null
|
||||||
],
|
],
|
||||||
"sublink" => [],
|
"sublink" => $sublinks,
|
||||||
"table" => []
|
"table" => []
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ class pinterest{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get($url, $get = []){
|
private function get($proxy, $url, $get = []){
|
||||||
|
|
||||||
$curlproc = curl_init();
|
$curlproc = curl_init();
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class pinterest{
|
||||||
curl_setopt($curlproc, CURLOPT_CONNECTTIMEOUT, 30);
|
curl_setopt($curlproc, CURLOPT_CONNECTTIMEOUT, 30);
|
||||||
curl_setopt($curlproc, CURLOPT_TIMEOUT, 30);
|
curl_setopt($curlproc, CURLOPT_TIMEOUT, 30);
|
||||||
|
|
||||||
$this->proxy->assign_proxy($curlproc);
|
$this->backend->assign_proxy($curlproc, $proxy);
|
||||||
|
|
||||||
$data = curl_exec($curlproc);
|
$data = curl_exec($curlproc);
|
||||||
|
|
||||||
|
@ -60,14 +60,28 @@ class pinterest{
|
||||||
|
|
||||||
public function image($get){
|
public function image($get){
|
||||||
|
|
||||||
$search = $get["s"];
|
if($get["npt"]){
|
||||||
|
|
||||||
$out = [
|
// @TODO
|
||||||
"status" => "ok",
|
// post data for next page
|
||||||
"npt" => null,
|
$data = [
|
||||||
"image" => []
|
"source_url" => "/search/pins/?q=" . urlencode($search) . "&rs=typed",
|
||||||
|
"data" =>
|
||||||
|
json_encode(
|
||||||
|
[
|
||||||
|
// {"options":{"applied_filters":null,"appliedProductFilters":"---","article":null,"auto_correction_disabled":false,"corpus":null,"customized_rerank_type":null,"domains":null,"filters":null,"journey_depth":null,"page_size":null,"price_max":null,"price_min":null,"query_pin_sigs":null,"query":"higurashi","redux_normalize_feed":true,"rs":"typed","scope":"pins","selected_one_bar_modules":null,"source_id":null,"source_module_id":null,"top_pin_id":null,"bookmarks":["Y2JVSG81V2sxcmNHRlpWM1J5VFVad1ZsWlVRbXhpVmtreVZsZHpOV0pIU2tkV2FscFhVbXhhVkZreU1WSmtNREZWVjIxR1RrMXNTbEJXYlhSaFVtMVdjMVZ1U2xaaWEzQnpXVlJPVTJWV1pISlhhM1JYVm10V05sVldVbE5XVjBwMVVXMUdWVll6VFhoVWJYaFhWMVp3Ums1V1RsTmlSbGt5Vm10YWFtVkdWbkpOU0dSUFZsZG9XRmxzWkc5VlZscHlWbGhrYkdKR1NubFdWelZQWVVaYWRHVkVRbFppUmtwVVZrUktWMlJIVWtWV2JHaHBVakZLU0Zkc1pEUmtNVnBZVW10b2FsSXdXbkJXYlRWRFpHeGFSMWRzVG1oaGVrWllXV3RvVTFVeFpFaFZiRUpoVm5wRk1GbHFSbXRYVjA1R1YyczFWMVpHV2pSWFZtaDNVakZrY2sxWVRsaGlhM0JXV1ZSR1MyRkdiRlZTYm1SVVVteHdXbGxWVlRGVk1VbDVWRmhrVjAxdVVuWlVhMXBTWlVaT2MxcEhSbE5TTWswMVdtdGFWMU5YU2paVmJYaFRUVmhDUjFZeU5YZFVNVkY0VjJ0b1ZXRnJOVlpVVmxwTFVURndXR042VmxOV2ExcGFXVlZWTlZVeFNYZE5WRTVYVWtWYVZGWkhNVTlXTVU1WllVWk9hR1ZyV2s1WFZ6QXhZakpPVjFWWWFHRlNWbkJRVm14U1IwMUdXWGxOVkVKVlRWWnNORll5TURWV1YwVjVWV3hDV21FeGNETmFSVnByVjFkS1IyTkhhR2xYUjJkM1ZtdGFhMlF4VVhsVGJGcE9Wa1p3YjFwWGVFdFZWbFp4VW14YWJGWnRVbHBaTUdoTFZHMUtTR1ZJYUZkV2VrWjJWMVphU21ReVJYcGpSbFpwVW10d1RGZHJVa0pPVms1SFZHNVNUbFl3V2xoVmJYUldaVVpaZUZremFGUk5hM0JYVkZaYVYyRkZNSGxWYkVKYVlrWlZlRnBGV210WFIwNUpVMnMxVTFaR1dscFdWekI0VFVaV1IxTllaR3BUUlhCb1dWUkdWbVZHVm5SbFJuQnNZbFpKTWxSVlVYaFBSVGxGV1hwR1QyVnJSVEZVVlZKT1RrVXhSVkpVUWs5bGJFVXhWRmhzZDFOR1ZsWmtNMFp0VWpGYWIxZFhjRXBsUlRGSVZWaHdUbFl4YTNoVVZWSnFUVVUxV0ZadGFFOVNSVnB6Vkd0a1drMUdiRFpUVkVaT1pXMWplRmRzVWxkaFJuQllWVlJTVDJWdFRqWlVNVkpTWlZad2NWcEhkRTlsYTFwMFZGVlNhMkpWTVZWVFZFcE9Wa1pzTmxkWE1WSk9WVEYwVlcweFVGWXdXVFJXUjNSWFYwZGFRbEJVTVRoUFJHTXhUbnBCTlUxRVRUUk5SRVV3VG5wUk5VMTVjRWhWVlhkeFprUlZlRTlFVVRKWlZHc3lUMWRSTWsxVVVUSk9iVnBvV1RKWmVrNTZXWGhPTWs1cFQwUkZNVTlFVm1sTlZGcHBUV3BTYTFsWFRtcE9SR015VG1wVk5GbHFaR2haVjFacldWUmFiVmxxWkdoYVZGWnFUa1JXT0ZSclZsaG1RVDA5fFVIbzVhRkpYZUc1WFYyUlpWVEpHYkdGNk1XWk5ha1ptVFZSR09FOUVZekZPZWtFMVRVUk5ORTFFUlRCT2VsRTFUWGx3U0ZWVmQzRm1SMWw1VFZSUk1WbDZUVEJhUjFGNVQxZFNhVnB0VlRGT1JFVXdXVlJuZVU1cVRUUk5hbU40VDBSSk1VNXFWVEZOYlZwcVdsUnJlRTFFVVhwWmVsVjNXbXBvYkU1dFJYbE9ha0Y2VDFSSk5VMTZWVEJaYWtJNFZHdFdXR1pCUFQwPXxOb25lfDg3NTcwOTAzODAxNDc0OTMqR1FMKnwzMjM3YjM3ZGNhMGU3YjYyYzYzYzAyZGJkNGU1MjdlNzMyMTExMTNlMmUyMzEyOWM2MDAzYmU1ZTlmZjkwYjAwfE5FV3w="]},"context":{}}
|
||||||
|
]
|
||||||
|
);
|
||||||
];
|
];
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$search = $get["s"];
|
||||||
|
if(strlen($search) === 0){
|
||||||
|
|
||||||
|
throw new Exception("Search term is empty!");
|
||||||
|
}
|
||||||
|
|
||||||
$filter = [
|
$filter = [
|
||||||
"source_url" => "/search/pins/?q=" . urlencode($search),
|
"source_url" => "/search/pins/?q=" . urlencode($search),
|
||||||
"rs" => "typed",
|
"rs" => "typed",
|
||||||
|
@ -95,10 +109,14 @@ class pinterest{
|
||||||
"_" => substr(str_replace(".", "", (string)microtime(true)), 0, -1)
|
"_" => substr(str_replace(".", "", (string)microtime(true)), 0, -1)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$proxy = $this->backend->get_ip();
|
||||||
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$json =
|
$json =
|
||||||
json_decode(
|
json_decode(
|
||||||
$this->get(
|
$this->get(
|
||||||
|
$proxy,
|
||||||
"https://www.pinterest.ca/resource/BaseSearchResource/get/",
|
"https://www.pinterest.ca/resource/BaseSearchResource/get/",
|
||||||
$filter
|
$filter
|
||||||
),
|
),
|
||||||
|
@ -115,7 +133,11 @@ class pinterest{
|
||||||
throw new Exception("Failed to decode JSON");
|
throw new Exception("Failed to decode JSON");
|
||||||
}
|
}
|
||||||
|
|
||||||
//print_r($json);
|
$out = [
|
||||||
|
"status" => "ok",
|
||||||
|
"npt" => null,
|
||||||
|
"image" => []
|
||||||
|
];
|
||||||
|
|
||||||
foreach(
|
foreach(
|
||||||
$json
|
$json
|
||||||
|
@ -189,7 +211,6 @@ class pinterest{
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "board":
|
case "board":
|
||||||
|
|
||||||
if(isset($item["cover_pin"]["image_url"])){
|
if(isset($item["cover_pin"]["image_url"])){
|
||||||
|
|
||||||
$image = [
|
$image = [
|
||||||
|
|
|
@ -353,25 +353,16 @@ class qwant{
|
||||||
"related" => []
|
"related" => []
|
||||||
];
|
];
|
||||||
|
|
||||||
if($json["status"] != "success"){
|
if(
|
||||||
|
$json["status"] != "success" &&
|
||||||
if($json["data"]["error_code"] === 5){
|
$json["data"]["error_code"] === 5
|
||||||
|
){
|
||||||
|
|
||||||
|
// no results
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($json["data"]["error_code"])){
|
$this->detect_errors($json);
|
||||||
|
|
||||||
switch($json["data"]["error_code"]){
|
|
||||||
|
|
||||||
case 27:
|
|
||||||
throw new Exception("Qwant returned a captcha");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Exception("Qwant returned an error code: " . $json["data"]["error_code"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!isset($json["data"]["result"]["items"]["mainline"])){
|
if(!isset($json["data"]["result"]["items"]["mainline"])){
|
||||||
|
|
||||||
|
@ -654,10 +645,7 @@ class qwant{
|
||||||
throw new Exception("Failed to decode JSON");
|
throw new Exception("Failed to decode JSON");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($json["status"] != "success"){
|
$this->detect_errors($json);
|
||||||
|
|
||||||
throw new Exception("Qwant returned an API error");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($json["data"]["result"]["items"]["mainline"])){
|
if(isset($json["data"]["result"]["items"]["mainline"])){
|
||||||
|
|
||||||
|
@ -754,10 +742,7 @@ class qwant{
|
||||||
throw new Exception("Could not parse JSON");
|
throw new Exception("Could not parse JSON");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($json["status"] != "success"){
|
$this->detect_errors($json);
|
||||||
|
|
||||||
throw new Exception("Qwant returned an API error");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($json["data"]["result"]["items"]["mainline"])){
|
if(isset($json["data"]["result"]["items"]["mainline"])){
|
||||||
|
|
||||||
|
@ -861,10 +846,7 @@ class qwant{
|
||||||
throw new Exception("Could not parse JSON");
|
throw new Exception("Could not parse JSON");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($json["status"] != "success"){
|
$this->detect_errors($json);
|
||||||
|
|
||||||
throw new Exception("Qwant returned an API error");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($json["data"]["result"]["items"]["mainline"])){
|
if(isset($json["data"]["result"]["items"]["mainline"])){
|
||||||
|
|
||||||
|
@ -906,6 +888,28 @@ class qwant{
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function detect_errors($json){
|
||||||
|
|
||||||
|
if(
|
||||||
|
isset($json["status"]) &&
|
||||||
|
$json["status"] == "error"
|
||||||
|
){
|
||||||
|
|
||||||
|
if(isset($json["data"]["error_data"]["captchaUrl"])){
|
||||||
|
|
||||||
|
throw new Exception("Qwant returned a captcha");
|
||||||
|
}elseif(isset($json["data"]["error_data"]["error_code"])){
|
||||||
|
|
||||||
|
throw new Exception(
|
||||||
|
"Qwant returned an API error: " .
|
||||||
|
$json["data"]["error_data"]["error_code"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception("Qwant returned an API error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function limitstrlen($text){
|
private function limitstrlen($text){
|
||||||
|
|
||||||
return explode("\n", wordwrap($text, 300, "\n"))[0];
|
return explode("\n", wordwrap($text, 300, "\n"))[0];
|
||||||
|
|
|
@ -6,6 +6,9 @@ class sc{
|
||||||
|
|
||||||
include "lib/backend.php";
|
include "lib/backend.php";
|
||||||
$this->backend = new backend("sc");
|
$this->backend = new backend("sc");
|
||||||
|
|
||||||
|
include "lib/fuckhtml.php";
|
||||||
|
$this->fuckhtml = new fuckhtml();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getfilters($page){
|
public function getfilters($page){
|
||||||
|
@ -25,7 +28,7 @@ class sc{
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get($proxy, $url, $get = []){
|
private function get($proxy, $url, $get = [], $web_req = false){
|
||||||
|
|
||||||
$curlproc = curl_init();
|
$curlproc = curl_init();
|
||||||
|
|
||||||
|
@ -37,9 +40,15 @@ class sc{
|
||||||
curl_setopt($curlproc, CURLOPT_URL, $url);
|
curl_setopt($curlproc, CURLOPT_URL, $url);
|
||||||
|
|
||||||
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
||||||
|
|
||||||
|
// use http2
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
||||||
|
|
||||||
|
if($web_req === false){
|
||||||
|
|
||||||
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
||||||
["User-Agent: " . config::USER_AGENT,
|
["User-Agent: " . config::USER_AGENT,
|
||||||
"Accept: application/json, text/javascript, */*; q=0.01",
|
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||||
"Accept-Language: en-US,en;q=0.5",
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
"Accept-Encoding: gzip",
|
"Accept-Encoding: gzip",
|
||||||
"Referer: https://soundcloud.com/",
|
"Referer: https://soundcloud.com/",
|
||||||
|
@ -48,8 +57,26 @@ class sc{
|
||||||
"Connection: keep-alive",
|
"Connection: keep-alive",
|
||||||
"Sec-Fetch-Dest: empty",
|
"Sec-Fetch-Dest: empty",
|
||||||
"Sec-Fetch-Mode: cors",
|
"Sec-Fetch-Mode: cors",
|
||||||
"Sec-Fetch-Site: same-site"]
|
"Sec-Fetch-Site: same-site",
|
||||||
|
"Priority: u=1"]
|
||||||
);
|
);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
||||||
|
["User-Agent: " . config::USER_AGENT,
|
||||||
|
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||||
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
|
"Accept-Encoding: gzip",
|
||||||
|
"DNT: 1",
|
||||||
|
"Connection: keep-alive",
|
||||||
|
"Upgrade-Insecure-Requests: 1",
|
||||||
|
"Sec-Fetch-Dest: document",
|
||||||
|
"Sec-Fetch-Mode: navigate",
|
||||||
|
"Sec-Fetch-Site: cross-site",
|
||||||
|
"Priority: u=1",
|
||||||
|
"TE: trailers"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
curl_setopt($curlproc, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($curlproc, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($curlproc, CURLOPT_SSL_VERIFYHOST, 2);
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYHOST, 2);
|
||||||
|
@ -300,9 +327,12 @@ class sc{
|
||||||
$description[] = $song["title"];
|
$description[] = $song["title"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($description) != 0){
|
if(count($description) !== 0){
|
||||||
|
|
||||||
$description = trim($count . " songs. " . implode(", ", $description));
|
$description = trim($count . " songs. " . implode(", ", $description));
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$description = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(
|
if(
|
||||||
|
@ -396,13 +426,48 @@ class sc{
|
||||||
|
|
||||||
$token = apcu_fetch("sc_token");
|
$token = apcu_fetch("sc_token");
|
||||||
|
|
||||||
if($token === false){
|
if($token !== false){
|
||||||
|
|
||||||
|
return $token;
|
||||||
|
}
|
||||||
|
|
||||||
|
// search through all javascript components on the main page
|
||||||
|
try{
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://soundcloud.com",
|
||||||
|
[],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch front page");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$scripts =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"script"
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($scripts as $script){
|
||||||
|
|
||||||
|
if(
|
||||||
|
!isset($script["attributes"]["src"]) ||
|
||||||
|
strpos($script["attributes"]["src"], "sndcdn.com") === false
|
||||||
|
){
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$js =
|
$js =
|
||||||
$this->get(
|
$this->get(
|
||||||
$proxy,
|
$proxy,
|
||||||
"https://a-v2.sndcdn.com/assets/0-a901c1e0.js",
|
$script["attributes"]["src"],
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
}catch(Exception $error){
|
}catch(Exception $error){
|
||||||
|
@ -416,16 +481,15 @@ class sc{
|
||||||
$token
|
$token
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!isset($token[1])){
|
if(isset($token[1])){
|
||||||
|
|
||||||
throw new Exception("Failed to get search token");
|
|
||||||
}
|
|
||||||
|
|
||||||
apcu_store("sc_token", $token[1]);
|
apcu_store("sc_token", $token[1]);
|
||||||
return $token[1];
|
return $token[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $token;
|
throw new Exception("Did not find a Soundcloud token in the Javascript blobs");
|
||||||
}
|
}
|
||||||
|
|
||||||
private function limitstrlen($text){
|
private function limitstrlen($text){
|
||||||
|
|
|
@ -0,0 +1,668 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class solofield{
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
|
||||||
|
include "lib/backend.php";
|
||||||
|
$this->backend = new backend("solofield");
|
||||||
|
|
||||||
|
include "lib/fuckhtml.php";
|
||||||
|
$this->fuckhtml = new fuckhtml();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getfilters($page){
|
||||||
|
|
||||||
|
return [
|
||||||
|
"nsfw" => [
|
||||||
|
"display" => "NSFW",
|
||||||
|
"option" => [
|
||||||
|
"yes" => "Yes",
|
||||||
|
"no" => "No",
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function get($proxy, $url, $get = []){
|
||||||
|
|
||||||
|
$curlproc = curl_init();
|
||||||
|
|
||||||
|
if($get !== []){
|
||||||
|
$get = http_build_query($get);
|
||||||
|
$url .= "?" . $get;
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
||||||
|
["User-Agent: " . config::USER_AGENT,
|
||||||
|
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||||
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
|
"Accept-Encoding: gzip",
|
||||||
|
"Referer: https://solofield.net",
|
||||||
|
"DNT: 1",
|
||||||
|
"Connection: keep-alive",
|
||||||
|
"Cookie: cross-site-cookie=name; lno=35842050",
|
||||||
|
"Upgrade-Insecure-Requests: 1",
|
||||||
|
"Sec-Fetch-Dest: document",
|
||||||
|
"Sec-Fetch-Mode: navigate",
|
||||||
|
"Sec-Fetch-Site: same-origin",
|
||||||
|
"Sec-Fetch-User: ?1"]
|
||||||
|
);
|
||||||
|
|
||||||
|
curl_setopt($curlproc, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYHOST, 2);
|
||||||
|
curl_setopt($curlproc, CURLOPT_SSL_VERIFYPEER, true);
|
||||||
|
curl_setopt($curlproc, CURLOPT_CONNECTTIMEOUT, 30);
|
||||||
|
curl_setopt($curlproc, CURLOPT_TIMEOUT, 30);
|
||||||
|
|
||||||
|
$this->backend->assign_proxy($curlproc, $proxy);
|
||||||
|
|
||||||
|
$data = curl_exec($curlproc);
|
||||||
|
|
||||||
|
if(curl_errno($curlproc)){
|
||||||
|
|
||||||
|
throw new Exception(curl_error($curlproc));
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_close($curlproc);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function web($get){
|
||||||
|
|
||||||
|
if($get["npt"]){
|
||||||
|
|
||||||
|
[$query, $proxy] = $this->backend->get($get["npt"], "web");
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://solofield.net/search?" . $query,
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch search page");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$proxy = $this->backend->get_ip();
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://solofield.net/search",
|
||||||
|
[
|
||||||
|
"q" => $get["s"],
|
||||||
|
"ie" => "UTF-8",
|
||||||
|
"oe" => "UTF-8",
|
||||||
|
"hl" => "ja", // changing this doesnt do anything
|
||||||
|
"lr" => "lang_ja", // same here
|
||||||
|
//"ls" => "", // ??
|
||||||
|
"f" => ($get["nsfw"] == "yes" ? "off" : "on")
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch search page");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = [
|
||||||
|
"status" => "ok",
|
||||||
|
"spelling" => [
|
||||||
|
"type" => "no_correction",
|
||||||
|
"using" => null,
|
||||||
|
"correction" => null
|
||||||
|
],
|
||||||
|
"npt" => null,
|
||||||
|
"answer" => [],
|
||||||
|
"web" => [],
|
||||||
|
"image" => [],
|
||||||
|
"video" => [],
|
||||||
|
"news" => [],
|
||||||
|
"related" => []
|
||||||
|
];
|
||||||
|
|
||||||
|
// check for errors and load the result div
|
||||||
|
if($this->error_and_load($html)){
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
$items =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"g0",
|
||||||
|
"li"
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($items as $item){
|
||||||
|
|
||||||
|
$this->fuckhtml->load($item);
|
||||||
|
|
||||||
|
$title_tag =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"r",
|
||||||
|
"h3"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($title_tag) === 0){
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fuckhtml->load($title_tag[0]);
|
||||||
|
|
||||||
|
$link =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"a"
|
||||||
|
)[0]
|
||||||
|
["attributes"]
|
||||||
|
["href"]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->fuckhtml->load($item);
|
||||||
|
$thumb =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"webshot",
|
||||||
|
"img"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($thumb) !== 0){
|
||||||
|
|
||||||
|
$uri =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$thumb[0]
|
||||||
|
["attributes"]
|
||||||
|
["src"]
|
||||||
|
);
|
||||||
|
|
||||||
|
if(stripos($uri, "now_printing") === false){
|
||||||
|
|
||||||
|
$thumb = [
|
||||||
|
"ratio" => "1:1",
|
||||||
|
"url" =>
|
||||||
|
"https://solofield.net" .
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$thumb[0]
|
||||||
|
["attributes"]
|
||||||
|
["src"]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$thumb = [
|
||||||
|
"ratio" => null,
|
||||||
|
"url" => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$thumb = [
|
||||||
|
"ratio" => null,
|
||||||
|
"url" => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$out["web"][] = [
|
||||||
|
"title" =>
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$title_tag[0]
|
||||||
|
),
|
||||||
|
"description" =>
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"s",
|
||||||
|
"div"
|
||||||
|
)[0]
|
||||||
|
),
|
||||||
|
"url" => $link,
|
||||||
|
"date" => null,
|
||||||
|
"type" => "web",
|
||||||
|
"thumb" => $thumb,
|
||||||
|
"sublink" => [],
|
||||||
|
"table" => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// get next page
|
||||||
|
$this->get_npt($html, $proxy, $out, "web");
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function image($get){
|
||||||
|
|
||||||
|
// no pagination
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$this->backend->get_ip(),
|
||||||
|
"https://solofield.net/isearch",
|
||||||
|
[
|
||||||
|
"q" => $get["s"],
|
||||||
|
"ie" => "UTF-8",
|
||||||
|
"oe" => "UTF-8",
|
||||||
|
"hl" => "ja", // changing this doesnt do anything
|
||||||
|
//"lr" => "lang_ja", // same here
|
||||||
|
"ls" => "", // ??
|
||||||
|
"f" => ($get["nsfw"] == "yes" ? "off" : "on")
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$out = [
|
||||||
|
"status" => "ok",
|
||||||
|
"npt" => null,
|
||||||
|
"image" => []
|
||||||
|
];
|
||||||
|
|
||||||
|
// check for errors and load the result div
|
||||||
|
if($this->error_and_load($html)){
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
$images =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"li"
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($images as $image){
|
||||||
|
|
||||||
|
$this->fuckhtml->load($image);
|
||||||
|
|
||||||
|
$img =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"img"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($img) === 0){
|
||||||
|
|
||||||
|
// ?? invalid
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$img = $img[0];
|
||||||
|
|
||||||
|
$size =
|
||||||
|
explode(
|
||||||
|
"x",
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$image
|
||||||
|
),
|
||||||
|
2
|
||||||
|
);
|
||||||
|
|
||||||
|
$size = [
|
||||||
|
(int)trim($size[0]), // width
|
||||||
|
(int)trim($size[1]) // height
|
||||||
|
];
|
||||||
|
|
||||||
|
$out["image"][] = [
|
||||||
|
"title" => null,
|
||||||
|
"source" => [
|
||||||
|
[
|
||||||
|
"url" =>
|
||||||
|
"https://solofield.net/" .
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$img["attributes"]["src"]
|
||||||
|
),
|
||||||
|
"width" => $size[0],
|
||||||
|
"height" => $size[1]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url" =>
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"a"
|
||||||
|
)[0]
|
||||||
|
["attributes"]
|
||||||
|
["href"]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function video($get){
|
||||||
|
|
||||||
|
if($get["npt"]){
|
||||||
|
|
||||||
|
[$query, $proxy] = $this->backend->get($get["npt"], "videos");
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://solofield.net/vsearch?" . $query,
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch search page");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$proxy = $this->backend->get_ip();
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
$html =
|
||||||
|
$this->get(
|
||||||
|
$proxy,
|
||||||
|
"https://solofield.net/vsearch",
|
||||||
|
[
|
||||||
|
"q" => $get["s"],
|
||||||
|
"ie" => "UTF-8",
|
||||||
|
"oe" => "UTF-8",
|
||||||
|
"hl" => "ja", // changing this doesnt do anything
|
||||||
|
//"lr" => "lang_ja", // same here
|
||||||
|
"ls" => "", // ??
|
||||||
|
"f" => ($get["nsfw"] == "yes" ? "off" : "on")
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}catch(Exception $error){
|
||||||
|
|
||||||
|
throw new Exception("Failed to fetch search page");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = [
|
||||||
|
"status" => "ok",
|
||||||
|
"npt" => null,
|
||||||
|
"video" => [],
|
||||||
|
"author" => [],
|
||||||
|
"livestream" => [],
|
||||||
|
"playlist" => [],
|
||||||
|
"reel" => []
|
||||||
|
];
|
||||||
|
|
||||||
|
// check for errors and load the result div
|
||||||
|
if($this->error_and_load($html)){
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
$items =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"li"
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($items as $item){
|
||||||
|
|
||||||
|
$this->fuckhtml->load($item);
|
||||||
|
|
||||||
|
$as =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"a"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($as) === 0){
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$thumb =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"img"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($thumb) !== 0){
|
||||||
|
|
||||||
|
$thumb = [
|
||||||
|
"ratio" => "16:9",
|
||||||
|
"url" =>
|
||||||
|
"https://solofield.net/" .
|
||||||
|
$thumb[0]
|
||||||
|
["attributes"]
|
||||||
|
["src"]
|
||||||
|
];
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$thumb = [
|
||||||
|
"ratio" => null,
|
||||||
|
"url" => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$date =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByAttributeValue(
|
||||||
|
"style",
|
||||||
|
"font-size: 10px;",
|
||||||
|
"span"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($date) !== 0){
|
||||||
|
|
||||||
|
$date =
|
||||||
|
$this->unfuckdate(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$date[0]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$date = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$center_td =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByAttributeValue(
|
||||||
|
"align",
|
||||||
|
"center",
|
||||||
|
"td"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($center_td) === 2){
|
||||||
|
|
||||||
|
$duration =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$this->hms2int(
|
||||||
|
$center_td[0]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$duration = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$out["video"][] = [
|
||||||
|
"title" =>
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$as[1]
|
||||||
|
),
|
||||||
|
"description" => null,
|
||||||
|
"author" => [
|
||||||
|
"name" => null,
|
||||||
|
"url" => null,
|
||||||
|
"avatar" => null
|
||||||
|
],
|
||||||
|
"date" => $date,
|
||||||
|
"duration" => $duration,
|
||||||
|
"views" => null,
|
||||||
|
"thumb" => $thumb,
|
||||||
|
"url" =>
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$as[0]
|
||||||
|
["attributes"]
|
||||||
|
["href"]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// get next page
|
||||||
|
$this->get_npt($html, $proxy, $out, "videos");
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function get_npt($html, $proxy, &$out, $type){
|
||||||
|
|
||||||
|
// get next page
|
||||||
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$pjs =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementById(
|
||||||
|
"pjs"
|
||||||
|
);
|
||||||
|
|
||||||
|
if($pjs){
|
||||||
|
|
||||||
|
$alnk =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
"alnk",
|
||||||
|
"span"
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($alnk as $lnk){
|
||||||
|
|
||||||
|
if(
|
||||||
|
stripos(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$lnk
|
||||||
|
),
|
||||||
|
"Next"
|
||||||
|
) !== false
|
||||||
|
){
|
||||||
|
|
||||||
|
$this->fuckhtml->load($lnk);
|
||||||
|
|
||||||
|
$out["npt"] =
|
||||||
|
$this->backend->store(
|
||||||
|
parse_url(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"a"
|
||||||
|
)[0]
|
||||||
|
["attributes"]
|
||||||
|
["href"],
|
||||||
|
PHP_URL_QUERY
|
||||||
|
),
|
||||||
|
$type,
|
||||||
|
$proxy
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function error_and_load($html){
|
||||||
|
|
||||||
|
if(strlen($html) === 0){
|
||||||
|
|
||||||
|
throw new Exception("Solofield blocked the request IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$list =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementById(
|
||||||
|
"list",
|
||||||
|
"div"
|
||||||
|
);
|
||||||
|
|
||||||
|
if($list === false){
|
||||||
|
|
||||||
|
$nosearch =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementById(
|
||||||
|
"nosearch",
|
||||||
|
"div"
|
||||||
|
);
|
||||||
|
|
||||||
|
if($nosearch){
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception("Failed to grep search list");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fuckhtml->load($list);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function unfuckdate($date){
|
||||||
|
|
||||||
|
return
|
||||||
|
strtotime(
|
||||||
|
rtrim(
|
||||||
|
preg_replace(
|
||||||
|
'/[^0-9]+/',
|
||||||
|
"-",
|
||||||
|
explode(
|
||||||
|
":",
|
||||||
|
$date,
|
||||||
|
2
|
||||||
|
)[1]
|
||||||
|
),
|
||||||
|
"-"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function hms2int($time){
|
||||||
|
|
||||||
|
$parts = explode(":", $time, 3);
|
||||||
|
$time = 0;
|
||||||
|
|
||||||
|
if(count($parts) === 3){
|
||||||
|
|
||||||
|
// hours
|
||||||
|
$time = $time + ((int)$parts[0] * 3600);
|
||||||
|
array_shift($parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($parts) === 2){
|
||||||
|
|
||||||
|
// minutes
|
||||||
|
$time = $time + ((int)$parts[0] * 60);
|
||||||
|
array_shift($parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
// seconds
|
||||||
|
$time = $time + (int)$parts[0];
|
||||||
|
|
||||||
|
return $time;
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -751,6 +751,13 @@ class yandex{
|
||||||
"url" => htmlspecialchars_decode($image["snippet"]["url"])
|
"url" => htmlspecialchars_decode($image["snippet"]["url"])
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// add preview URL
|
||||||
|
$tmp["source"][] = [
|
||||||
|
"url" => htmlspecialchars_decode($image["viewerData"]["preview"][0]["url"]),
|
||||||
|
"width" => (int)$image["viewerData"]["preview"][0]["w"],
|
||||||
|
"height" => (int)$image["viewerData"]["preview"][0]["h"],
|
||||||
|
];
|
||||||
|
|
||||||
foreach($image["viewerData"]["dups"] as $dup){
|
foreach($image["viewerData"]["dups"] as $dup){
|
||||||
|
|
||||||
$tmp["source"][] = [
|
$tmp["source"][] = [
|
||||||
|
@ -767,8 +774,8 @@ class yandex{
|
||||||
"https://",
|
"https://",
|
||||||
htmlspecialchars_decode($image["viewerData"]["thumb"]["url"])
|
htmlspecialchars_decode($image["viewerData"]["thumb"]["url"])
|
||||||
),
|
),
|
||||||
"width" => (int)$image["viewerData"]["thumb"]["size"]["width"],
|
"width" => (int)$image["viewerData"]["thumb"]["w"],
|
||||||
"height" => (int)$image["viewerData"]["thumb"]["size"]["height"]
|
"height" => (int)$image["viewerData"]["thumb"]["h"]
|
||||||
];
|
];
|
||||||
|
|
||||||
$out["image"][] = $tmp;
|
$out["image"][] = $tmp;
|
||||||
|
|
|
@ -252,21 +252,30 @@ class yep{
|
||||||
|
|
||||||
curl_setopt($curlproc, CURLOPT_URL, $url);
|
curl_setopt($curlproc, CURLOPT_URL, $url);
|
||||||
|
|
||||||
|
// use http2
|
||||||
|
curl_setopt($curlproc, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
|
||||||
|
|
||||||
|
// set ciphers
|
||||||
|
curl_setopt(
|
||||||
|
$curlproc,
|
||||||
|
CURLOPT_SSL_CIPHER_LIST,
|
||||||
|
"aes_128_gcm_sha_256,chacha20_poly1305_sha_256,aes_256_gcm_sha_384,ecdhe_ecdsa_aes_128_gcm_sha_256,ecdhe_rsa_aes_128_gcm_sha_256,ecdhe_ecdsa_chacha20_poly1305_sha_256,ecdhe_rsa_chacha20_poly1305_sha_256,ecdhe_ecdsa_aes_256_gcm_sha_384,ecdhe_rsa_aes_256_gcm_sha_384,ecdhe_ecdsa_aes_256_sha,ecdhe_ecdsa_aes_128_sha,ecdhe_rsa_aes_128_sha,ecdhe_rsa_aes_256_sha,rsa_aes_128_gcm_sha_256,rsa_aes_256_gcm_sha_384,rsa_aes_128_sha,rsa_aes_256_sha"
|
||||||
|
);
|
||||||
|
|
||||||
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
curl_setopt($curlproc, CURLOPT_ENCODING, ""); // default encoding
|
||||||
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
curl_setopt($curlproc, CURLOPT_HTTPHEADER,
|
||||||
["User-Agent: " . config::USER_AGENT,
|
["User-Agent: " . config::USER_AGENT,
|
||||||
"Accept: */*",
|
"Accept: */*",
|
||||||
"Accept-Language: en-US,en;q=0.5",
|
"Accept-Language: en-US,en;q=0.5",
|
||||||
"Accept-Encoding: gzip, deflate, br, zstd",
|
"Accept-Encoding: gzip, deflate, br, zstd",
|
||||||
"Connection: keep-alive",
|
|
||||||
"DNT: 1",
|
|
||||||
"Priority: u=1",
|
|
||||||
"Origin: https://yep.com",
|
|
||||||
"Referer: https://yep.com/",
|
"Referer: https://yep.com/",
|
||||||
|
"Origin: https://yep.com",
|
||||||
|
"DNT: 1",
|
||||||
"Connection: keep-alive",
|
"Connection: keep-alive",
|
||||||
"Sec-Fetch-Dest: empty",
|
"Sec-Fetch-Dest: empty",
|
||||||
"Sec-Fetch-Mode: cors",
|
"Sec-Fetch-Mode: cors",
|
||||||
"Sec-Fetch-Site: same-site",
|
"Sec-Fetch-Site: same-site",
|
||||||
|
"Priority: u=4",
|
||||||
"TE: trailers"]
|
"TE: trailers"]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
52
settings.php
52
settings.php
|
@ -79,10 +79,22 @@ $settings = [
|
||||||
"value" => "google",
|
"value" => "google",
|
||||||
"text" => "Google"
|
"text" => "Google"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "startpage",
|
||||||
|
"text" => "Startpage"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"value" => "kagi",
|
||||||
|
"text" => "Kagi"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"value" => "qwant",
|
"value" => "qwant",
|
||||||
"text" => "Qwant"
|
"text" => "Qwant"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "ghostery",
|
||||||
|
"text" => "Ghostery"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"value" => "yep",
|
"value" => "yep",
|
||||||
"text" => "Yep"
|
"text" => "Yep"
|
||||||
|
@ -121,10 +133,22 @@ $settings = [
|
||||||
"value" => "google",
|
"value" => "google",
|
||||||
"text" => "Google"
|
"text" => "Google"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "google_cse",
|
||||||
|
"text" => "Google CSE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"value" => "startpage",
|
||||||
|
"text" => "Startpage"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"value" => "qwant",
|
"value" => "qwant",
|
||||||
"text" => "Qwant"
|
"text" => "Qwant"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "ghostery",
|
||||||
|
"text" => "Ghostery"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"value" => "yep",
|
"value" => "yep",
|
||||||
"text" => "Yep"
|
"text" => "Yep"
|
||||||
|
@ -145,6 +169,10 @@ $settings = [
|
||||||
"value" => "mojeek",
|
"value" => "mojeek",
|
||||||
"text" => "Mojeek"
|
"text" => "Mojeek"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "solofield",
|
||||||
|
"text" => "Solofield"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"value" => "marginalia",
|
"value" => "marginalia",
|
||||||
"text" => "Marginalia"
|
"text" => "Marginalia"
|
||||||
|
@ -179,6 +207,14 @@ $settings = [
|
||||||
"value" => "google",
|
"value" => "google",
|
||||||
"text" => "Google"
|
"text" => "Google"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "google_cse",
|
||||||
|
"text" => "Google CSE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"value" => "startpage",
|
||||||
|
"text" => "Startpage"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"value" => "qwant",
|
"value" => "qwant",
|
||||||
"text" => "Qwant"
|
"text" => "Qwant"
|
||||||
|
@ -187,6 +223,10 @@ $settings = [
|
||||||
"value" => "yep",
|
"value" => "yep",
|
||||||
"text" => "Yep"
|
"text" => "Yep"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "solofield",
|
||||||
|
"text" => "Solofield"
|
||||||
|
],
|
||||||
/*[
|
/*[
|
||||||
"value" => "pinterest",
|
"value" => "pinterest",
|
||||||
"text" => "Pinterest"
|
"text" => "Pinterest"
|
||||||
|
@ -225,10 +265,18 @@ $settings = [
|
||||||
"value" => "google",
|
"value" => "google",
|
||||||
"text" => "Google"
|
"text" => "Google"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "startpage",
|
||||||
|
"text" => "Startpage"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"value" => "qwant",
|
"value" => "qwant",
|
||||||
"text" => "Qwant"
|
"text" => "Qwant"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "solofield",
|
||||||
|
"text" => "Solofield"
|
||||||
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -247,6 +295,10 @@ $settings = [
|
||||||
"value" => "google",
|
"value" => "google",
|
||||||
"text" => "Google"
|
"text" => "Google"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"value" => "startpage",
|
||||||
|
"text" => "Startpage"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"value" => "qwant",
|
"value" => "qwant",
|
||||||
"text" => "Qwant"
|
"text" => "Qwant"
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
:root
|
||||||
|
{
|
||||||
|
--accent : #f79e98;
|
||||||
|
--1d2021 : #180d0c;
|
||||||
|
--282828 : #180d0c;
|
||||||
|
--3c3836 : #251615;
|
||||||
|
--504945 : #251615;
|
||||||
|
--928374 : var(--accent);
|
||||||
|
--a89984 : #d8c5c4;
|
||||||
|
--bdae93 : #d8c5c4;
|
||||||
|
--8ec07c : var(--accent);
|
||||||
|
--ebdbb2 : #d8c5c4;
|
||||||
|
--comment: #928374;
|
||||||
|
--default: #DCC9BC;
|
||||||
|
--keyword: #F07342;
|
||||||
|
--string : var(--accent);
|
||||||
|
--green : #959A6B;
|
||||||
|
--yellow : #E39C45;
|
||||||
|
--red : #CF223E;
|
||||||
|
--white : var(--a89984);
|
||||||
|
--black : var(--1d2021);
|
||||||
|
--hover : #b18884
|
||||||
|
}
|
||||||
|
|
||||||
|
a.link, a { color: var(--accent); text-decoration: none; }
|
||||||
|
.searchbox { width: 23%; }
|
||||||
|
.filters filter select { color: #E39C45; }
|
||||||
|
.web .separator::before { color: var(--white) }
|
||||||
|
.searchbox input[type="text"]::placeholder { color: var(--white); }
|
||||||
|
a.link:hover
|
||||||
|
{
|
||||||
|
color: var(--hover);
|
||||||
|
text-shadow: 0 0 .2rem var(--hover);
|
||||||
|
}
|
||||||
|
.code-inline
|
||||||
|
{ border-color: var(--default); font-family: monospace;}
|
||||||
|
.home #center a
|
||||||
|
{ color: var(--accent); }
|
||||||
|
.home .subtext
|
||||||
|
{ color: var(--white); }
|
|
@ -0,0 +1,20 @@
|
||||||
|
<a href="/" class="link">< Go back</a>
|
||||||
|
|
||||||
|
<h1>Donate to the project</h1>
|
||||||
|
This project takes up most of my free time and costs money to run. If you feel like this project is worthy of a donation, please do so using the resources on this page!<br><br>
|
||||||
|
|
||||||
|
To run smoothly, 4get requires 20$/month for the server fees and 15-25$ for residential proxies. I also have plans to build my own index to provide better search results; funds raised here will go directly towards better hardware for these purposes. According to the number of captchas solved, <a href="https://4get.ca">4get.ca</a> serves between 800-1400 users every day, or around 7000-10000 searches!
|
||||||
|
|
||||||
|
<h2>Ko-fi</h2>
|
||||||
|
This is the most convenient way to donate. Supports PayPal.
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://ko-fi.com/lolcat">ko-fi.com/lolcat</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Monero</h2>
|
||||||
|
Due to popular demand, I have added an XMR addy. I'm planning to reward users who donate to me once paid tiers are introduced to 4get, so please let me know through email that you donated to me (don't forget your transaction ID)!
|
||||||
|
<ul>
|
||||||
|
<li><a href="monero:85G95fXXfuh72oQd9LmdMHNqDTqsUPKkLCBEYE7XnnMLPvBfkdnan2FVTmVAwT4JEuXsRL7xPgqzuV2YdbFkWmxK2FgGBmB?tx_description=4get+donation">85G95fXXfuh72oQd9LmdMHNqDTqsUPKkLCBEYE7XnnMLPvBfkdnan2FVTmVAwT4JEuXsRL7xPgqzuV2YdbFkWmxK2FgGBmB</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
Thank you all for your generous support!!
|
|
@ -28,7 +28,8 @@
|
||||||
<div class="autocomplete"></div>
|
<div class="autocomplete"></div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<a href="settings">Settings</a> • <a href="instances">Instances</a> • <a href="https://git.lolcat.ca/lolcat/4get_news">News</a> • <a href="api.txt">API</a> • <a href="about">About</a> • <a href="https://git.lolcat.ca/lolcat/4get">Source</a> • <a href="https://ko-fi.com/lolcat" rel="noreferrer" target="BLANK">Donate</a>
|
<a href="settings">Settings</a> • <a href="instances">Instances</a> • <a href="https://git.lolcat.ca/lolcat/4get_news">News</a> • <a href="api.txt">API</a> • <a href="about">About</a> • <a href="https://git.lolcat.ca/lolcat/4get">Source</a><br>
|
||||||
|
<a href="/donate"><b>Donate to the project</b></a>
|
||||||
<div class="subtext">
|
<div class="subtext">
|
||||||
<a href="https://4get.ca">Clearnet</a> • <a href="http://4getwebfrq5zr4sxugk6htxvawqehxtdgjrbcn2oslllcol2vepa23yd.onion">Tor</a> • <a href="https://lolcat.ca">Report a problem</a><br>
|
<a href="https://4get.ca">Clearnet</a> • <a href="http://4getwebfrq5zr4sxugk6htxvawqehxtdgjrbcn2oslllcol2vepa23yd.onion">Tor</a> • <a href="https://lolcat.ca">Report a problem</a><br>
|
||||||
Running on <b>v{%version%}</b>!!
|
Running on <b>v{%version%}</b>!!
|
||||||
|
|
Loading…
Reference in New Issue