mirror of
https://github.com/gurnec/removeddit.git
synced 2026-03-11 08:54:27 +00:00
Cleaned up some debugging stuff
This commit is contained in:
parent
7281ca23d5
commit
341c63e3ea
2 changed files with 6 additions and 18 deletions
|
|
@ -77,7 +77,7 @@ return {
|
|||
init.headers.Authorization = "bearer " + json.access_token;
|
||||
})
|
||||
.catch(function(error) {
|
||||
return Promise.reject("Can't connect to Reddit API (402)");
|
||||
return Promise.reject("Can't connect to Reddit API (401)");
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -86,10 +86,6 @@ return {
|
|||
|
||||
// Helper functions for fetch
|
||||
var Fetch2 = (function(){
|
||||
var json = function(response) {
|
||||
return response.json();
|
||||
};
|
||||
|
||||
return {
|
||||
multiple: function(urls, init, jsonPath, flattening) {
|
||||
flattening = _.defaultTo(flattening, true);
|
||||
|
|
@ -97,7 +93,7 @@ return {
|
|||
|
||||
return Promise.all(_.map(urls, function(url) {
|
||||
return fetch(url, init)
|
||||
.then(json)
|
||||
.then(Fetch2.json)
|
||||
.then(function(jsonArray) {
|
||||
if(! _.isNil(jsonPath)) {
|
||||
return _.get(jsonArray, jsonPath);
|
||||
|
|
@ -112,9 +108,9 @@ return {
|
|||
return dataArray;
|
||||
});
|
||||
},
|
||||
json: json
|
||||
|
||||
|
||||
json: function(response) {
|
||||
return response.json();
|
||||
}
|
||||
}})();
|
||||
|
||||
var URLs = (function(){
|
||||
|
|
|
|||
|
|
@ -34,14 +34,12 @@ return {
|
|||
|
||||
Status.loading("Loading comments from reddit...");
|
||||
HandleIDs.normal(thread);
|
||||
console.log("After normal", Comments.ids.length);
|
||||
return HandleIDs.morechildren()
|
||||
.catch(function(error){
|
||||
return Promise.reject("Could not get comments from Reddit (moreChildren)");
|
||||
});
|
||||
})
|
||||
.then(function(){
|
||||
console.log("After morechildren", Comments.ids.length);
|
||||
return Promise.all(_.map(_.uniq(Comments.countinuethread), function(id) {
|
||||
return fetch(URLs.thread+"/_/"+id.split("_")[1], Reddit.init)
|
||||
.then(Fetch2.json)
|
||||
|
|
@ -55,12 +53,8 @@ return {
|
|||
_.forEach(smallerThreads, function(thread){
|
||||
HandleIDs.normal(thread);
|
||||
})
|
||||
console.log("After continueThisThread", Comments.ids.length);
|
||||
console.log("Total", Comments.ids.length);
|
||||
console.log("Unique", _.uniq(Comments.ids).length);
|
||||
Status.loading("Getting removed comments...");
|
||||
HandleIDs.removed();
|
||||
console.log("Removed", Comments.removed.length);
|
||||
ThreadHTML.createCommentInfo(Comments.removed.length);
|
||||
return Fetch2.multiple(URLs.format(URLs.pushshiftComments, Comments.removed), null, "data")
|
||||
.catch(function(error){
|
||||
|
|
@ -184,8 +178,6 @@ return {
|
|||
|
||||
return getParentComments(Comments.removed)
|
||||
.then(function(){
|
||||
//console.log("Removed length", Comments.removed.length)
|
||||
//console.log("ToBeCreated", Comments.toBeCreated);
|
||||
ThreadHTML.createCommentSection();
|
||||
ThreadHTML.createComments();
|
||||
})
|
||||
|
|
@ -409,5 +401,5 @@ var ThreadHTML = (function(){
|
|||
})();
|
||||
|
||||
if(isSupported) {
|
||||
app.loadPage()
|
||||
app.loadPage();
|
||||
}
|
||||
Loading…
Reference in a new issue