-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract.php
64 lines (57 loc) · 1.96 KB
/
extract.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
// Full-Text RSS: Simple extraction - results in JSON
// Author: Keyvan Minoukadeh
// Copyright (c) 2014 Keyvan Minoukadeh
// License: AGPLv3
// Version: 3.3
// Date: 2014-05-07
// More info: http://fivefilters.org/content-only/
// Help: http://help.fivefilters.org
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Usage
// -----
// Request this file passing it a web page URL in the querystring: extract.php?url=example.org
// You can use GET and POST requests.
// You'll get a simple JSON response:
/*
HTTP/1.0 200 OK
{
"title": "Blowing Smoke with Boxing's Big Voice",
"content" <div><p>Content here</p><p>More content</p></div>",
"author": "Rafi Kohan",
"excerpt": "Short extract from the beginning of the article.",
"language": "en",
"url": "http://example.org/article.html",
"effective_url": "http://example.org/article.html",
"date": "2014-05-10"
}
*/
define('_FF_FTR_MODE', 'simple');
// Don't process URL as feed
$_POST['accept'] = 'html';
// JSON output only
$_POST['format'] = 'json';
// Enable excerpts
$_POST['summary'] = '1';
// Don't produce result if extraction fails
$_POST['exc'] = '1';
// Enable XSS filtering (unless explicitly disabled)
if (isset($_POST['xss']) && $_POST['xss'] !== '0') {
$_POST['xss'] = '1';
} elseif (isset($_GET['xss']) && $_GET['xss'] !== '0') {
$_GET['xss'] = '1';
} else {
$_POST['xss'] = '1';
}
require 'makefulltextfeed.php';