aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Controller
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-08-24 12:27:17 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-08-24 12:27:17 +0200
commitfad316151c282b2383fae751f7ca45373f1f26ed (patch)
treeef024e9a523d9dd2fa322161bab12ad4472bb272 /src/Wallabag/ApiBundle/Controller
parent8c55a9e6c9a563c3a4b3b3d35581e1c67a8a8c04 (diff)
downloadwallabag-fad316151c282b2383fae751f7ca45373f1f26ed.tar.gz
wallabag-fad316151c282b2383fae751f7ca45373f1f26ed.tar.zst
wallabag-fad316151c282b2383fae751f7ca45373f1f26ed.zip
Integrate graby
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller')
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php11
1 files changed, 8 insertions, 3 deletions
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
147 { 147 {
148 $url = $request->request->get('url'); 148 $url = $request->request->get('url');
149 149
150 $content = Extractor::extract($url); 150 $content = $this->get('wallabag_core.graby')->fetchContent($url);
151
151 $entry = new Entry($this->getUser()); 152 $entry = new Entry($this->getUser());
152 $entry->setUrl($url); 153 $entry->setUrl($url);
153 $entry->setTitle($request->request->get('title') ?: $content->getTitle()); 154 $entry->setTitle($request->request->get('title') ?: $content['title']);
154 $entry->setContent($content->getBody()); 155 $entry->setContent($content['html']);
156 $entry->setMimetype($content['content_type']);
157 if (isset($content['open_graph']['og_image'])) {
158 $entry->setPreviewPicture($content['open_graph']['og_image']);
159 }
155 160
156 $tags = $request->request->get('tags', ''); 161 $tags = $request->request->get('tags', '');
157 if (!empty($tags)) { 162 if (!empty($tags)) {