aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller/WallabagRestController.php')
-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)) {