From 2ffd846352aa8fbb53bd940964524ebba34c33d9 Mon Sep 17 00:00:00 2001 From: tigerbot Date: Mon, 10 Jul 2017 17:06:34 -0600 Subject: [PATCH] fixed problem in http redirect paywall detection --- packages/apis/com.daplie.goldilocks/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/apis/com.daplie.goldilocks/index.js b/packages/apis/com.daplie.goldilocks/index.js index c6d6e82..1855644 100644 --- a/packages/apis/com.daplie.goldilocks/index.js +++ b/packages/apis/com.daplie.goldilocks/index.js @@ -63,6 +63,7 @@ module.exports.create = function (deps, conf) { } function checkPaywall() { + var url = require('url'); var PromiseA = require('bluebird'); var testDomains = [ 'daplie.com' @@ -118,11 +119,11 @@ module.exports.create = function (deps, conf) { }); var proms = testDomains.map(function (dom) { - return request('https://'+dom).then(function (resp) { + return request('http://'+dom).then(function (resp) { if (resp.statusCode >= 300 && resp.statusCode < 400) { - return resp.headers.location; + return url.parse(resp.headers.location).hostname; } else { - return 'https://'+dom; + return dom; } }); });