]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/WallabagRestController.php
Merge pull request #1447 from wallabag/v2-typo
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / WallabagRestController.php
index d5579de4e18c4cb8fc06de4546898a67f29b96f9..349229f384524fd7c4bd03b6b13c52886ec48409 100644 (file)
@@ -8,7 +8,6 @@ use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
 use Wallabag\CoreBundle\Entity\Entry;
 use Wallabag\CoreBundle\Entity\Tag;
-use Wallabag\CoreBundle\Service\Extractor;
 use Hateoas\Configuration\Route;
 use Hateoas\Representation\Factory\PagerfantaFactory;
 
@@ -147,16 +146,10 @@ class WallabagRestController extends Controller
     {
         $url = $request->request->get('url');
 
-        $content = $this->get('wallabag_core.graby')->fetchContent($url);
-
-        $entry = new Entry($this->getUser());
-        $entry->setUrl($url);
-        $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']);
-        }
+        $entry = $this->get('wallabag_core.content_proxy')->updateEntry(
+            new Entry($this->getUser()),
+            $url
+        );
 
         $tags = $request->request->get('tags', '');
         if (!empty($tags)) {