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
4131161c
Commit
4131161c
authored
Jul 07, 2016
by
Dominik Hebeler
Browse files
Yandex Parser eingefügt
parent
eb07078c
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
app/Models/parserSkripte/Yandex.php
View file @
4131161c
...
...
@@ -2,6 +2,7 @@
namespace
app\Models\parserSkripte
;
use
App\Models\Searchengine
;
use
Log
;
class
Yandex
extends
Searchengine
{
...
...
@@ -14,22 +15,40 @@ class Yandex extends Searchengine
public
function
loadResults
(
$result
)
{
$result
=
preg_replace
(
"/
\r\n
/si"
,
""
,
$result
);
try
{
$content
=
simplexml_load_string
(
$result
);
}
catch
(
\
Exception
$e
)
{
abort
(
500
,
"
$result
is not a valid xml string"
);
}
$title
=
""
;
$link
=
""
;
if
(
!
$content
)
{
return
;
}
$results
=
$content
;
try
{
$results
=
$results
->
xpath
(
"//yandexsearch/response/results/grouping/group"
);
}
catch
(
\
ErrorException
$e
)
{
return
;
}
foreach
(
$results
as
$result
)
{
$title
=
strip_tags
(
$result
->
{
"doc"
}
->
{
"title"
}
->
asXML
());
$link
=
$result
->
{
"doc"
}
->
{
"url"
}
->
__toString
();
$anzeigeLink
=
$link
;
$descr
=
""
;
#die($result);
/*$this->counter++;
$descr
=
strip_tags
(
$result
->
{
"doc"
}
->
{
"headline"
}
->
asXML
());
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
$this
->
engine
,
$title
,
$link
,
$anzeigeLink
,
$descr
,
$this
->
gefVon
,
$this
->
counter
);*/
);
}
}
}
Write
Preview
Supports
Markdown
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