diff options
Diffstat (limited to 'src/Wallabag/ApiBundle')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/WallabagRestController.php | 11 | ||||
-rw-r--r-- | src/Wallabag/ApiBundle/Resources/config/services.yml | 3 |
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 | ||