Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Searx Proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
Searx Proxy
Commits
83ed36c1
Commit
83ed36c1
authored
4 years ago
by
Davide Aprea
Browse files
Options
Downloads
Patches
Plain Diff
add command to generate a list of instances
parent
247d967e
No related branches found
No related tags found
1 merge request
!1
Development
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
app/Console/Commands/SearxInstances.php
+59
-0
59 additions, 0 deletions
app/Console/Commands/SearxInstances.php
with
60 additions
and
0 deletions
.gitignore
+
1
−
0
View file @
83ed36c1
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
/public/hot
/public/hot
/public/storage
/public/storage
/storage/*.key
/storage/*.key
/storage/instances.txt
/vendor
/vendor
.env
.env
.env.backup
.env.backup
...
...
This diff is collapsed.
Click to expand it.
app/Console/Commands/SearxInstances.php
0 → 100644
+
59
−
0
View file @
83ed36c1
<?php
namespace
App\Console\Commands
;
use
Illuminate\Console\Command
;
class
SearxInstances
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'instances:load'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'loads a list of running searx instances ( https://searx.space )'
;
/**
* Create a new command instance.
*
* @return void
*/
public
function
__construct
()
{
parent
::
__construct
();
}
/**
* Execute the console command.
*
* @return int
*/
public
function
handle
()
{
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
'https://searx.space/data/instances.json'
);
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
FALSE
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
TRUE
);
$response
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
$response
=
json_decode
(
$response
);
if
(
$response
!==
null
){
$f
=
fopen
(
'storage/instances.txt'
,
'w'
);
foreach
(
$response
->
instances
as
$instance
=>
$data
)
{
if
(
!
isset
(
$data
->
{
'error'
})
&&
$data
->
{
'network_type'
}
!==
'tor'
)
{
fwrite
(
$f
,
$instance
.
"
\n
"
);
}
}
fclose
(
$f
);
}
else
{
echo
"Unable to locate file. Check https://searx.space/data/instances.json for more info
\n
"
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment