X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FController%2FWallabagRestController.php;h=d5579de4e18c4cb8fc06de4546898a67f29b96f9;hb=fad316151c282b2383fae751f7ca45373f1f26ed;hp=02a6de64c9297d69809bdb4b71f32bee62f6fb25;hpb=8c55a9e6c9a563c3a4b3b3d35581e1c67a8a8c04;p=github%2Fwallabag%2Fwallabag.git 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)) {