aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle
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
parent8c55a9e6c9a563c3a4b3b3d35581e1c67a8a8c04 (diff)
downloadwallabag-fad316151c282b2383fae751f7ca45373f1f26ed.tar.gz
wallabag-fad316151c282b2383fae751f7ca45373f1f26ed.tar.zst
wallabag-fad316151c282b2383fae751f7ca45373f1f26ed.zip
Integrate graby
Diffstat (limited to 'src/Wallabag/ApiBundle')
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php11
-rw-r--r--src/Wallabag/ApiBundle/Resources/config/services.yml3
2 files changed, 11 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)) {
diff --git a/src/Wallabag/ApiBundle/Resources/config/services.yml b/src/Wallabag/ApiBundle/Resources/config/services.yml
index 6854a444..9ab4f3d1 100644
--- a/src/Wallabag/ApiBundle/Resources/config/services.yml
+++ b/src/Wallabag/ApiBundle/Resources/config/services.yml
@@ -10,3 +10,6 @@ services:
10 tags: 10 tags:
11 - { name: monolog.logger, channel: wsse } 11 - { name: monolog.logger, channel: wsse }
12 arguments: ['@security.context', '@security.authentication.manager', '@logger'] 12 arguments: ['@security.context', '@security.authentication.manager', '@logger']
13
14 wallabag_core.graby:
15 class: Graby\Graby