Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

license headers and a lot of documentation

  • Loading branch information...
commit da1016ae0ab8908591aca87121e5f882b4629a13 1 parent aeb64e5
@4poc authored
View
12 feedability.js
@@ -1,5 +1,5 @@
/**
- * Feedability: NodeJS Feed Proxy With Readability
+ * Feedability: Node.js Feed Proxy With Readability
* Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
*
* This program is free software: you can redistribute it and/or modify
@@ -17,6 +17,12 @@
*/
console.log('Starting Feedability: NodeJS Feed Proxy With Readability\n');
+/**
+ * Core module for startup and shutdown of the feedability HTTP server.
+ *
+ * @fileOverview
+ */
+
// built in libraries
var fs = require('fs'),
http = require('http'),
@@ -24,12 +30,10 @@ var fs = require('fs'),
// internal libraries
var cfg = require('./lib/cfg.js'),
+ log = new (require('./lib/log.js').Logger)('core'),
func = require('./lib/func.js'),
ProxyRequest = require('./lib/proxy.js').ProxyRequest;
-// create local logging object
-var log = new (require('./lib/log.js').Logger)('core');
-
// some variables used for the http server
var bind = cfg.get('proxy')['bind'];
var port = cfg.get('proxy')['port'];
View
68 lib/cache.js
@@ -1,44 +1,36 @@
-var log = new (require('./log.js').Logger)('cache');
-
-/*
-var uri = require('url'),
- fs = require('fs');
-var func = require('./func.js'),
- cfg = require('./cfg.js');
-
-// returns the name of the cache file for the supplied url
-function filename(ext, url)
-{
- var domain = uri.parse(url).hostname,
- urlhash = func.sha1(url);
- var cache_path = cfg.get('cache')['path']+'/'+domain;
-
- if(!func.file_exists(cache_path)) {
- log.info('create non-existing domain directory', domain);
- fs.mkdirSync(cache_path, 0755);
- }
-
- return cache_path + '/' + urlhash + '.' + ext;
-}
-exports.filename = filename;
-
-// make sure the caching directory exists, if not create it (sync)
-exports.create_path = function() {
- var cache_path = cfg.get('cache')['path'];
- if(!func.file_exists(cache_path)) {
- log.info('create cache directory: '+cache_path);
- fs.mkdirSync(cache_path, 0755);
- }
-};
-*/
-
-
-
-
+/**
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Contains the class for cache accessing, it is used to store
+ * received feeds and pages by the urlopen module and to cache the
+ * content extracted by readability.
+ *
+ * @fileOverview
+ */
+
+// built in libraries
var fs = require('fs'),
uri = require('url');
-var func = require('./func.js'),
+// internal libraries
+var log = new (require('./log.js').Logger)('cache'),
+ func = require('./func.js'),
cfg = require('./cfg.js');
var Cache = function(url, extension) {
View
32 lib/ce.js
@@ -1,17 +1,43 @@
-var log = new (require('./log.js').Logger)('ce');
+/**
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Contains a class for content extraction based on arc90's
+ * Readability. This is the place where future development of
+ * other content extraction algorithms and/or template detection
+ * systems _could_ be developed.
+ *
+ * @fileOverview
+ */
// built in libraries
var fs = require('fs'),
uri = require('url');
// internal libraries
-var func = require('./func.js'),
+var log = new (require('./log.js').Logger)('ce'),
+ func = require('./func.js'),
cfg = require('./cfg.js'),
Filter = require('./filter.js').Filter,
Cache = require('./cache.js').Cache,
urlopen = require('./urlopen.js');
-
+// external libraries
var readability = require('readability');
View
27 lib/cfg.js
@@ -1,8 +1,33 @@
/**
- * Module to load and access settings.
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
+/**
+ * Module provides methods for accessing the json based configuration
+ * settings.
+ *
+ * @fileOverview
+ */
+
+// built in libraries
var fs = require('fs'),
util = require('util');
+
+// external libraries
var func = require('./func.js');
var settings = null;
View
23 lib/entity.js
@@ -1,7 +1,26 @@
/**
- * XML and HTML Entity Encoding/Decoding
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
*
- * @author Matthias -apoc- Hecker
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Provide methods for XML and HTML entity encoding and decoding based
+ * on w3c's XML and HTML 4 specifications.
+ *
+ * @fileOverview
*/
/**
View
33 lib/feed.js
@@ -1,4 +1,22 @@
/**
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
* Contains the feed class for parsing and generating the XML based
* feeds. Atom and RSS feeds are supported. Its not meant to be a
* complete implementation of RSS or Atom, thats the job of the
@@ -7,21 +25,20 @@
* @fileOverview
*/
-var log = new (require('./log.js').Logger)('feed');
-
// built-in libraries
var util = require('util');
-// external libraries
-var expat = require('node-expat');
-
// internal libraries
-var func = require('./func.js'),
+var log = new (require('./log.js').Logger)('feed'),
+ func = require('./func.js'),
cfg = require('./cfg.js'),
entity = require('./entity.js'),
cache = require('./cache.js'),
urlopen = require('./urlopen.js');
+// external libraries
+var expat = require('node-expat');
+
/**
* # Feedability Feed Parser/Generator Class (Constructor)
*
@@ -298,8 +315,8 @@ Feed.prototype.expatEndElement = function(name) {
Feed.prototype.expatText = function(text) {
log.debug('expat stream event: text, text length: '+text.length);
if(!this.cdata_text) {
- // decode the xml entities of non-cdata text nodes:
- text = entity.decode(text);
+ // encode the xml entities of non-cdata text nodes:
+ text = entity.encode(text, {numbered: true});
}
if(this.prev_open) this.stream += '>';
View
33 lib/filter.js
@@ -1,18 +1,43 @@
-var log = new (require('./log.js').Logger)('filter');
+/**
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Module provide filtering class for pre and post processing of
+ * feed, to be more precise: the dom and regular expression based
+ * manipulation of single received pages/ feed items.
+ *
+ * @fileOverview
+ */
// built in libraries
var fs = require('fs'),
uri = require('url'),
util = require('util');
-var jsdom = require('jsdom');
-
// internal libraries
-var func = require('./func.js'),
+var log = new (require('./log.js').Logger)('filter'),
+ func = require('./func.js'),
cfg = require('./cfg.js'),
Cache = require('./cache.js').Cache,
urlopen = require('./urlopen.js');
+// external libraries
+var jsdom = require('jsdom');
var Filter = function(url) {
View
47 lib/func.js
@@ -1,20 +1,47 @@
/**
- * Node.js Utility Functions
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
*
- * This file is a collection of javascript and nodejs helper
- * functions. Besides node.js there are no external libraries
- * required.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Convenient collection of JavaScript and Node.js helper functions,
+ * the methods do not touch any object prototypes. No function has
+ * any internal dependency except the built-in Node.js libraries.
+ *
+ * @fileOverview
*/
-var uri = require('url'),
- fs = require('fs'),
+
+var func = exports;
+
+// built in libraries
+var fs = require('fs'),
+ uri = require('url'),
crypto = require('crypto');
/*****************************************************************************
* Object Functions
*****************************************************************************/
-// merge properties of two objects recursively together
-function object_merge(obj1, obj2) {
+/**
+ * Merge Two Objects Recursively,
+ * converts boolean strings (true, false) to boolean primitives.
+ *
+ * @param object
+ */
+func.object_merge = function(obj1, obj2) {
// @http://stackoverflow.com/questions/171251/how-can-i-merge-properties-
// of-two-javascript-objects-dynamically/383245#383245
for(var key in obj2) {
@@ -41,8 +68,8 @@ function object_merge(obj1, obj2) {
}
}
return obj1;
-}
-exports.object_merge = object_merge;
+};
+// exports.object_merge = object_merge;
exports.object_empty = function(object) {
for(var prop in object) {
View
36 lib/log.js
@@ -1,14 +1,44 @@
/**
- * Class for logging to console and file with loglevels. Example:
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
*
- * > var log = new require('./log.js').Logger('filters');
- * > log.warn('no need to mention warning here its prefixed', domain);
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Class for console and file logging, works sync/async, supports
+ * log levels and is customizable by the feedability configuration
+ * file.
+ *
+ * @fileOverview
*/
+// built in libraries
var fs = require('fs'),
uri = require('url');
+
+// internal libraries
var func = require('./func.js');
+/**
+ * Usage Example:
+ *
+ * <pre>
+ * var log = new require('./log.js').Logger('filters');
+ * log.warn('no need to mention warning here its prefixed', domain);
+ * </pre>
+ */
var Logger = function(module) {
this.module = module;
View
135 lib/proxy.js
@@ -1,15 +1,47 @@
-var log = new (require('./log.js').Logger)('proxy');
+/**
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * Contains class for processing proxy requests.
+ *
+ * @fileOverview
+ */
+
+// built in libraries
var uri = require('url'),
util = require('util'),
fs = require('fs');
-
-var urlopen = require('./urlopen.js'),
+
+// internal libraries
+var log = new (require('./log.js').Logger)('proxy'),
+ urlopen = require('./urlopen.js'),
func = require('./func.js'),
cfg = require('./cfg.js'),
Feed = require('./feed.js').Feed,
ContentExtraction = require('./ce.js').ContentExtraction;
+/**
+ * Class for serving proxy request.
+ *
+ * @param request http client request
+ * @param response http server response
+ * @class
+ */
var ProxyRequest = function(request, response) {
var match = null,
parsed = uri.parse(request.url, true);
@@ -49,6 +81,13 @@ var ProxyRequest = function(request, response) {
}
}
+/**
+ * Write content to server response. if not already this writes
+ * the http header too.
+ *
+ * @param content the http body content to write
+ * @param headers additional headers to write (on first write)
+ */
ProxyRequest.prototype.write = function(content, headers) {
if(!this.wroteHead) {
this.response.writeHead(this.code,
@@ -67,10 +106,20 @@ ProxyRequest.prototype.write = function(content, headers) {
this.response.write(content);
}
+/**
+ * Finishes the writing of data to the server response.
+ */
ProxyRequest.prototype.end = function() {
this.response.end();
}
+/**
+ * Loads a static file from disk, replaces variables within and
+ * writes the contents to the server response.
+ *
+ * @param filename name of the static file (within the static folder)
+ * @param vars variables to replace within the static file (replace {key})
+ */
ProxyRequest.prototype.renderStatic = function(filename, vars) {
log.info('render static file: '+filename)
var content = fs.readFileSync('./static/' + filename, 'utf-8');
@@ -99,11 +148,25 @@ ProxyRequest.prototype.renderStatic = function(filename, vars) {
this.end();
}
+/**
+ * Serve an error message to the client.
+ *
+ * @param message the error message
+ * @param code optional http response
+ * code (default: 500 Internal Server Error)
+ */
ProxyRequest.prototype.error = function(message, code) {
this.code = code || 500; // Default: Internal Server Error
this.renderStatic('error.html', {message: message});
}
+/**
+ * Checks if the user is authenticated and if the settings require
+ * an authentication.
+ *
+ * @returns true in case of successfull auth or no authentication
+ * is required
+ */
ProxyRequest.prototype.authenticated = function() {
if(this.settings.use_auth) {
log.debug('start');
@@ -131,10 +194,19 @@ ProxyRequest.prototype.authenticated = function() {
return true;
}
+/**
+ * Just renders the static page, default template variables are
+ * replaced.
+ * @see renderStatic
+ */
ProxyRequest.prototype.processStaticRequest = function() {
this.renderStatic(this.static);
}
+/**
+ * Process external proxy request, for feed or other external page.
+ * This tries to extract the main content from the received pages.
+ */
ProxyRequest.prototype.processProxyRequest = function() {
var proxy = this,
start_request = func.ms();
@@ -151,7 +223,12 @@ ProxyRequest.prototype.processProxyRequest = function() {
proxy.xresp = (func.ms() - start_request)+'ms,'+url_response.data_length+'/'+url_content.length;
// process based on mime type
- if(proxy.mime == 'application/rss+xml' || proxy.mime == 'application/atom+xml') {
+
+ // feed mime types (the mime types are correctly detected by looking
+ // into the content (this happens in the urlopen module))
+ if(proxy.mime == 'application/rss+xml' ||
+ proxy.mime == 'application/atom+xml') {
+
var feed = new Feed(url_content, proxy.url, proxy.mime);
feed.parse(function(error){
if(error) {
@@ -167,13 +244,18 @@ ProxyRequest.prototype.processProxyRequest = function() {
}
proxy.write(feed.getOuterPre());
- // execute after finishing an item
+ // Function queries finished extracted article items, finished
+ // articles are written to the response or queried for later
+ // if the preserve_order option is turned on. (the preserve_order
+ // option can be selected by including the preserve_order
+ // argument in the url.
var send_items = 0;
var item_queue = [];
function send_finished(item, i) {
var item_content = feed.createItemContents(item);
if(proxy.settings.preserve_order) {
+ // query at the correct position (original position/order)
item_queue[i] = item_content;
}
else {
@@ -181,6 +263,7 @@ ProxyRequest.prototype.processProxyRequest = function() {
item_queue.push(item_content);
}
+ // iterate over queue, write conjoined items to response
for(var n = send_items; n < feed.getItems().length; n++) {
if(item_queue[n]) {
proxy.write(item_queue[n]);
@@ -192,6 +275,7 @@ ProxyRequest.prototype.processProxyRequest = function() {
}
}
+ // write feed footer and end response writing
if(send_items >= feed.getItems().length) {
// write tail section of the feed
proxy.write(feed.getOuterPost());
@@ -205,7 +289,7 @@ ProxyRequest.prototype.processProxyRequest = function() {
var ce = new ContentExtraction(),
items = feed.getItems();
- for(var i in items) { (function() {
+ for(var i = 0; i < items.length; ++i) { (function() {
var index = i, // important for order preserving
item = items[i];
@@ -233,25 +317,58 @@ ProxyRequest.prototype.processProxyRequest = function() {
}); // end of feed parse method callback
}
+
+ else if (this.mime.indexOf('html') != -1) {
+ var ce = new ContentExtraction();
+ ce.extractByUrl(proxy.url, function(error, content, url) {
+ if(error) {
+ error = 'unable to extract content from url' + error;
+ log.error(error, url);
+ proxy.error(error);
+ }
+ else {
+ log.info('content extracted: '+content.length, item_url);
+ proxy.write(content);
+ }
+ });
+ }
+
else {
- proxy.error('Unable to process content other then rss or atom feeds');
+ proxy.error('Unable to process content other then http, ' +
+ 'rss or atom feeds');
+
}
});
}
+/**
+ * Process the request, check for authentication and serve
+ * proxy request or static request.
+ */
ProxyRequest.prototype.process = function() {
+ // all pages need authentication, the stylesheet is used
+ // to style the error message (-.-)
if(this.static != 'style.css' && !this.authenticated()) {
return;
}
- if(this.url && (this.parsed.protocol == 'http:' || this.parsed.protocol == 'https:') && this.host != '') {
+ // the request is processed in the constructor, this processes
+ // the proxy request (request for another external page or feed)
+ if(this.url && (this.parsed.protocol == 'http:' ||
+ this.parsed.protocol == 'https:') && this.host != '') {
+
this.processProxyRequest();
}
+
+ // static page found (all files under /static can be served this way
+ // the / url is served as a static request to /static/index.html
else if(this.static) {
this.processStaticRequest();
}
+
+ // no url or static file requested
else {
- this.error('unable to process request');
+ this.error('unable to process request', 404);
}
}
View
49 lib/urlopen.js
@@ -1,4 +1,28 @@
-var log = new (require('./log.js').Logger)('urlopen');
+/**
+ * Feedability: Node.js Feed Proxy With Readability
+ * Copyright (c) 2011, Matthias -apoc- Hecker <http://apoc.cc/>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Methods for requesting HTTP pages, supports the GET method, gzip
+ * compression, automatic charset recoding to UTF-8 (using iconv),
+ * caching using Etag or Last-modified headers, HTTP redirection, etc.
+ *
+ * @fileOverview
+ */
// built in libraries
var http = require('http'),
@@ -7,27 +31,14 @@ var http = require('http'),
util = require('util');
// internal libraries
-var func = require('./func.js'),
+var log = new (require('./log.js').Logger)('urlopen'),
+ func = require('./func.js'),
cfg = require('./cfg.js'),
Cache = require('./cache.js').Cache;
-// require compress as an optional feature
-var compress = null;
-try {
- var compress = require('compress');
-}
-catch(e) {
- log.warn('optional compress module not found (no urlopen gzip support)');
-}
-
-// require compress as an "optional" feature
-var Iconv = null;
-try {
- var Iconv = require('iconv').Iconv;
-}
-catch(e) {
- log.warn('optional iconv module not found (no urlopen charset encoding)');
-}
+// external libraries
+var compress = require('compress'),
+ Iconv = require('iconv').Iconv;
/**
* Detect Content-Type on various factors
View
37 test/urlopen.js
@@ -70,40 +70,3 @@ exports.testDetectContentType = function(test) {
test.done();
}
-/**
- * Detect Content-Type on various factors
- *
- * In most cases the web server already returns a content-type,
- * but that value may not be accurate. This method detects the
- * xml formats atom and rss and the xml and html charset
- * attributes. The returned object looks like:
- * <pre>
- * {
- * header: "text/html; charset=ISO-8859-4",
- * mime: "text/html",
- * charset: "ISO-8859-4",
- * binary: false // assume binary content
- * }
- * </pre>
- *
- * @param headers of request may include content-type
- * @param buffer or string with file contents
- * @return object with content type string, mime and charset
- */
-
-
-urlopen.open('http://apoc.cc/encoding_test.php?charset=iso',
-// 'http://www.giessener-allgemeine.de/Home/Stadt/Uebersicht/Artikel,-Protest-gegen-Verkauf-des-Parkhauses-Roonstrasse-_arid,242093_regid,1_puid,1_pageid,113.html',
-// http://www.giessener-allgemeine.de/cms_media/xml/7_az_stadt.xml', //'http://apoc.cc/encoding_test.php?charset=s',
-// http://www.spiegel.de/politik/ausland/0,1518,747173,00.html',
-// http://apoc.cc/encoding_test.php?charset=utf8',
-// http://feeds.guardian.co.uk/theguardian/rss
-// http://www.spiegel.de/netzwelt/gadgets/0,1518,722478,00.html',
-// http://apoc.cc/encoding_test.php?charset=utf8', // #'utf8',
- function(error, content, response) {
- console.log(error);
- console.log(content);
- console.log(typeof content);
- console.log(typeof response);
- }
-);
Please sign in to comment.
Something went wrong with that request. Please try again.