Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
MetaGer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
56
Issues
56
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
open-source
MetaGer
Commits
66a7c376
Commit
66a7c376
authored
Jun 19, 2018
by
Dominik Hebeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shopzilla hinzugefügt
parent
21b2b2cc
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2732 additions
and
2631 deletions
+2732
-2631
app/MetaGer.php
app/MetaGer.php
+1
-1
app/Models/Result.php
app/Models/Result.php
+2
-1
app/Models/parserSkripte/Shopzilla.php
app/Models/parserSkripte/Shopzilla.php
+100
-0
package-lock.json
package-lock.json
+2629
-2629
No files found.
app/MetaGer.php
View file @
66a7c376
...
...
@@ -422,7 +422,7 @@ class MetaGer
$hash
=
$el
[
1
];
foreach
(
$results
as
$result
)
{
if
(
$hoster
===
$result
->
tld
)
{
if
(
$hoster
===
$result
->
tld
&&
!
$result
->
partnershop
)
{
# Hier ist ein Advertiser:
# Das Logo hinzufügen:
if
(
$result
->
image
!==
""
)
{
...
...
app/Models/Result.php
View file @
66a7c376
...
...
@@ -270,7 +270,8 @@ class Result
strpos
(
$this
->
strippedHost
,
"twitter.com"
)
===
false
&&
strpos
(
$this
->
strippedHost
,
"www.ladenpreis.net"
)
===
false
&&
strpos
(
$this
->
strippedHost
,
"ncbi.nlm.nih.gov"
)
===
false
&&
strpos
(
$this
->
strippedHost
,
"www.onenewspage.com"
)
===
false
)
{
strpos
(
$this
->
strippedHost
,
"www.onenewspage.com"
)
===
false
&&
$this
->
gefVon
!==
"Shopzilla"
){
$count
=
$metager
->
getHostCount
(
$this
->
strippedHost
);
if
(
$count
>=
3
)
{
return
false
;
...
...
app/Models/parserSkripte/Shopzilla.php
0 → 100644
View file @
66a7c376
<?php
namespace
app\Models\parserSkripte
;
use
App\Models\Searchengine
;
use
Log
;
class
Shopzilla
extends
Searchengine
{
public
$results
=
[];
public
function
__construct
(
\
SimpleXMLElement
$engine
,
\
App\MetaGer
$metager
)
{
parent
::
__construct
(
$engine
,
$metager
);
}
public
function
loadResults
(
$result
)
{
$result
=
preg_replace
(
"/
\r\n
/si"
,
""
,
$result
);
try
{
$content
=
simplexml_load_string
(
$result
);
if
(
!
$content
)
{
return
;
}
$results
=
$content
->
{
"Products"
};
$count
=
0
;
foreach
(
$results
->
{
"Offer"
}
as
$result
)
{
$title
=
$result
->
{
"title"
}
->
__toString
();
$link
=
$result
->
{
"url"
}
->
__toString
();
$anzeigeLink
=
$result
->
{
"rawUrl"
}
->
__toString
();
$descr
=
$result
->
{
"description"
}
->
__toString
();
$image
=
$result
->
{
"Images"
}
->
{
"Image"
}[
1
]
->
__toString
();
$price
=
$result
->
{
"price"
}
->
__toString
();
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
$this
->
engine
,
$title
,
$link
,
$anzeigeLink
,
$descr
,
$this
->
displayName
,
$this
->
homepage
,
$this
->
counter
,
[
'partnershop'
=>
true
,
'price'
=>
$price
,
'image'
=>
$image
]
);
$count
++
;
}
}
catch
(
\
Exception
$e
)
{
Log
::
error
(
"A problem occurred parsing results from
$this->name
:"
);
Log
::
error
(
$e
->
getMessage
());
return
;
}
}
public
function
getNext
(
\
App\MetaGer
$metager
,
$result
)
{
$result
=
preg_replace
(
"/
\r\n
/si"
,
""
,
$result
);
try
{
$content
=
simplexml_load_string
(
$result
);
if
(
!
$content
)
{
return
;
}
}
catch
(
\
Exception
$e
)
{
Log
::
error
(
"A problem occurred parsing results from
$this->name
:"
);
Log
::
error
(
$e
->
getMessage
());
return
;
}
// Get total Result Count
$totalResults
=
intval
(
$content
->
{
"Products"
}[
"totalResults"
]
->
__toString
());
// Get the current Result Position
$current
=
0
;
if
(
strpos
(
$this
->
getString
,
"&start="
)
!==
FALSE
){
$tmp
=
substr
(
$this
->
getString
,
strpos
(
$this
->
getString
,
"&start="
)
+
7
);
if
(
strpos
(
$tmp
,
"&"
)
!==
FALSE
){
$tmp
=
substr
(
$tmp
,
0
,
strpos
(
$tmp
,
"&"
));
}
$current
=
intval
(
$tmp
);
}
if
(
$current
>=
(
$totalResults
-
10
)){
return
;
}
# Erstellen des neuen Suchmaschinenobjekts und anpassen des GetStrings:
$next
=
new
Shopzilla
(
simplexml_load_string
(
$this
->
engine
),
$metager
);
if
(
strpos
(
$next
->
getString
,
"&start="
)
!==
FALSE
){
$next
->
getString
=
preg_replace
(
"/&start=\d+/si"
,
"&start="
.
(
$current
+
10
),
$next
->
getString
);
}
else
{
$next
->
getString
.
=
"&start="
.
(
$current
+
10
);
}
$next
->
hash
=
md5
(
$next
->
host
.
$next
->
getString
.
$next
->
port
.
$next
->
name
);
$this
->
next
=
$next
;
}
}
package-lock.json
View file @
66a7c376
This diff is collapsed.
Click to expand it.
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