fixed problem in http redirect paywall detection
This commit is contained in:
parent
1957dd8d80
commit
2ffd846352
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue