From fad316151c282b2383fae751f7ca45373f1f26ed Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 24 Aug 2015 12:27:17 +0200 Subject: Integrate graby --- src/Wallabag/ApiBundle/Controller/WallabagRestController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/ApiBundle/Controller') diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 02a6de64..d5579de4 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -147,11 +147,16 @@ class WallabagRestController extends Controller { $url = $request->request->get('url'); - $content = Extractor::extract($url); + $content = $this->get('wallabag_core.graby')->fetchContent($url); + $entry = new Entry($this->getUser()); $entry->setUrl($url); - $entry->setTitle($request->request->get('title') ?: $content->getTitle()); - $entry->setContent($content->getBody()); + $entry->setTitle($request->request->get('title') ?: $content['title']); + $entry->setContent($content['html']); + $entry->setMimetype($content['content_type']); + if (isset($content['open_graph']['og_image'])) { + $entry->setPreviewPicture($content['open_graph']['og_image']); + } $tags = $request->request->get('tags', ''); if (!empty($tags)) { -- cgit v1.2.3