]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/WallabagRestController.php
Integrate graby
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / WallabagRestController.php
index 02a6de64c9297d69809bdb4b71f32bee62f6fb25..d5579de4e18c4cb8fc06de4546898a67f29b96f9 100644 (file)
@@ -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)) {