Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
7e5a5a8b
Commit
7e5a5a8b
authored
May 19, 2020
by
Dominik Hebeler
Browse files
Now using our random useragent for requests
parent
be43c3ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Console/Commands/RequestFetcher.php
View file @
7e5a5a8b
...
...
@@ -180,12 +180,12 @@ class RequestFetcher extends Command
private
function
getCurlHandle
(
$job
)
{
$ch
=
curl_init
();
curl_setopt_array
(
$ch
,
array
(
CURLOPT_URL
=>
$job
[
"url"
],
CURLOPT_PRIVATE
=>
$job
[
"resulthash"
]
.
";"
.
$job
[
"cacheDuration"
],
CURLOPT_RETURNTRANSFER
=>
1
,
CURLOPT_USERAGENT
=>
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"
,
CURLOPT_USERAGENT
=>
$job
[
"useragent"
]
,
CURLOPT_FOLLOWLOCATION
=>
true
,
CURLOPT_CONNECTTIMEOUT
=>
2
,
CURLOPT_MAXCONNECTS
=>
500
,
...
...
app/Models/Searchengine.php
View file @
7e5a5a8b
...
...
@@ -49,6 +49,8 @@ abstract class Searchengine
}
$this
->
cacheDuration
=
max
(
$this
->
cacheDuration
,
5
);
// Thanks to our Middleware this is a almost completely random useragent
// which matches the correct device type
$this
->
useragent
=
$metager
->
getUserAgent
();
$this
->
ip
=
$metager
->
getIp
();
$this
->
startTime
=
microtime
(
true
);
...
...
@@ -143,6 +145,7 @@ abstract class Searchengine
$mission
=
[
"resulthash"
=>
$this
->
hash
,
"url"
=>
$url
,
"useragent"
=>
$this
->
useragent
,
"username"
=>
$this
->
username
,
"password"
=>
$this
->
password
,
"headers"
=>
$this
->
headers
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment