commit e011162861f5be288c309e79255539e3818da7a9 Author: Is Isilon Date: Sat Feb 6 19:14:52 2016 +0800 Added datatables, and better stemming diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58c3d86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,57 @@ + +# Created by https://www.gitignore.io/api/node,bower,linux + +### Node ### +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +node_modules + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + + +### Bower ### +bower_components +.bower-cache +.bower-registry +.bower-tmp + + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* diff --git a/README.md b/README.md new file mode 100644 index 0000000..5724ccd --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ + +Thinking about improving keyword shitter. + +E.g. like http://answerthepublic.com/seeds/95429 + + +Ways to visualise: +- http://bl.ocks.org/tmcw/4063830 +- http://jsfiddle.net/4yttq/1/ + + +# TODO: + +change how it stems searches + +datatables for visualisation + +with length column + +keywordkeg + +cache to indexdb + +remember how many done on this ip diff --git a/package.json b/package.json new file mode 100644 index 0000000..4d0ae86 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "keywordshitter2", + "version": "0.0.5", + "description": "Thinking about improving keyword shitter.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "MIT" +} diff --git a/public/bl.png b/public/bl.png new file mode 100644 index 0000000..1fcdccb Binary files /dev/null and b/public/bl.png differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..cd4518f --- /dev/null +++ b/public/index.html @@ -0,0 +1,93 @@ + + +Keyword Shitter - The Bulk Keyword Tool + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ + +
+ +
+
+ + + Shit Keywords! +
+ + + + + + +
+
+ + + +
+
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + +
idKeywordLengthSearchesCPC
+
+
+ + +
+ + + + + + + + + + + + + + + + diff --git a/public/jstrie.html b/public/jstrie.html new file mode 100644 index 0000000..901d77e --- /dev/null +++ b/public/jstrie.html @@ -0,0 +1,149 @@ + + + + + + + + + +
+ + + + diff --git a/public/main.js b/public/main.js new file mode 100644 index 0000000..5479288 --- /dev/null +++ b/public/main.js @@ -0,0 +1,270 @@ +var keywordsToDisplay = new Array(); +var hashMapResults = {}; +var numOfInitialKeywords = 0; +var doWork = false; +var keywordsToQuery = new Array(); +var keywordsToQueryIndex = 0; +var queryflag = false; +var table; + +window.setInterval(DoJob, 750); + +function StartJob() { + if (doWork == false) { + keywordsToDisplay = new Array(); + hashMapResults = {}; + keywordsToQuery = new Array(); + keywordsToQueryIndex = 0; + + hashMapResults[""] = 1; + hashMapResults[" "] = 1; + hashMapResults[" "] = 1; + + var ks = $('#input').val().split("\n"); + var i = 0; + for (i = 0; i < ks.length; i++) { + keywordsToQuery[keywordsToQuery.length] = {Keyword: ks[i]}; + keywordsToDisplay[keywordsToDisplay.length]= {Keyword: ks[i]}; + + var j = 0; + for (j = 0; j < 26; j++) { + var chr = String.fromCharCode(97 + j); + var currentx = ks[i] + ' ' + chr; + keywordsToQuery[keywordsToQuery.length] = {Keyword: currentx}; + hashMapResults[currentx] = 1; + } + } + //document.getElementById("input").value = ''; + //document.getElementById("input").value += "\n"; + numOfInitialKeywords = keywordsToDisplay.length; + FilterAndDisplay(); + + doWork = true; + $('#startjob').val('Stop Job').text('Stop Job').addClass('btn-danger'); + + } else { + doWork = false; + alertify.alert("Stopped"); + $('#startjob').val('Start Job').text('Start Job').removeClass('btn-danger'); + } +} + +function DoJob() { + if (doWork == true && queryflag == false) { + if (keywordsToQueryIndex < keywordsToQuery.length) { + var currentKw = keywordsToQuery[keywordsToQueryIndex].Keyword; + QueryKeyword(currentKw); + keywordsToQueryIndex++; + } else { + if (numOfInitialKeywords != keywordsToDisplay.length) { + alertify.alert("Done"); + doWork = false; + $('#startjob').val('Start Job'); + } else { + keywordsToQueryIndex = 0; + } + } + } +} + +function QueryKeyword(keyword) { + var querykeyword = keyword; + //var querykeyword = encodeURIComponent(keyword); + var queryresult = ''; + queryflag = true; + + $.ajax({ + url: "http://suggestqueries.google.com/complete/search", + jsonp: "jsonp", + dataType: "jsonp", + data: { + q: querykeyword, + client: "chrome" + }, + success: function (res) { + var retList = res[1]; + + // sort so the shortest is first in the queue + // retList.sort(function (a, b) { + // return a.length - b.length; + // }); + + var i = 0; + for (i = 0; i < retList.length; i++) { + var currents = CleanVal(retList[i]); + if (hashMapResults[currents] != 1) { + hashMapResults[currents] = 1; + var cleanKw = CleanVal(retList[i]); + keywordsToDisplay[keywordsToDisplay.length] = {Keyword:cleanKw}; + table.row.add([keywordsToDisplay.length,cleanKw,cleanKw.length]).draw( false ); + + keywordsToQuery[keywordsToQuery.length] = {Keyword: currents}; + + var prefixes = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'y', 'x', 'y', 'z', 'how', 'which', 'why', 'where', 'who', 'when', 'are', 'what']; + var suffixes = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'y', 'x', 'y', 'z', 'like', 'for', 'without', 'with', 'verses', 'to', 'near', 'except']; + + for (var k = 0; k < prefixes.length; k++) { + var chr = prefixes[k]; + var currentx = chr + ' ' + currents; + keywordsToQuery[keywordsToQuery.length] = {Keyword: currentx}; + hashMapResults[currentx] = 1; + } + for (var j = 0; j < prefixes.length; j++) { + var chr = prefixes[j]; + var currentx = currents + ' ' + chr; + keywordsToQuery[keywordsToQuery.length] = {Keyword: currentx}; + hashMapResults[currentx] = 1; + } + } + } + table.draw(); + FilterAndDisplay(); + var textarea = document.getElementById("input"); + textarea.scrollTop = textarea.scrollHeight; + queryflag = false; + } + }); +} + +function CleanVal(input) { + var val = input; + val = val.replace("\\u003cb\\u003e", ""); + val = val.replace("\\u003c\\/b\\u003e", ""); + val = val.replace("\\u003c\\/b\\u003e", ""); + val = val.replace("\\u003cb\\u003e", ""); + val = val.replace("\\u003c\\/b\\u003e", ""); + val = val.replace("\\u003cb\\u003e", ""); + val = val.replace("\\u003cb\\u003e", ""); + val = val.replace("\\u003c\\/b\\u003e", ""); + val = val.replace("\\u0026amp;", "&"); + val = val.replace("\\u003cb\\u003e", ""); + val = val.replace("\\u0026", ""); + val = val.replace("\\u0026#39;", "'"); + val = val.replace("#39;", "'"); + val = val.replace("\\u003c\\/b\\u003e", ""); + val = val.replace("\\u2013", "2013"); + if (val.length > 4 && val.substring(0, 4) == "http") val = ""; + return val; +} + +function Filter(listToFilter) { + var retList = listToFilter; + + if (document.getElementById("filter-positive").value.length > 0) { + var filteredList = new Array(); + var filterContains = document.getElementById("filter-positive").value.split("\n"); + var i = 0; + for (i = 0; i < retList.length; i++) { + var currentKeyword = retList[i]; + var boolContainsKeyword = false; + var j = 0; + for (j = 0; j < filterContains.length; j++) { + if (filterContains[j].length > 0) { + if (currentKeyword.indexOf(filterContains[j]) != -1) { + boolContainsKeyword = true; + break; + } + } + } + + if (boolContainsKeyword) { + filteredList[filteredList.length] = currentKeyword; + } + } + + retList = filteredList; + } + + if (document.getElementById("filter-negative").value.length > 0) { + var filteredList = new Array(); + var filterContains = document.getElementById("filter-negative").value.split("\n"); + var i = 0; + for (i = 0; i < retList.length; i++) { + var currentKeyword = retList[i]; + var boolCleanKeyword = true; + var j = 0; + for (j = 0; j < filterContains.length; j++) { + if (filterContains[j].length > 0) { + if (currentKeyword.indexOf(filterContains[j]) >= 0) { + boolCleanKeyword = false; + break; + } + } + } + + if (boolCleanKeyword) { + filteredList[filteredList.length] = currentKeyword; + } + } + + retList = filteredList; + } + + return retList; +} + +function FilterAndDisplay() { + var i = 0; + var sb = ''; + var outputKeywords = Filter(keywordsToDisplay); + for (i = 0; i < outputKeywords.length; i++) { + sb += outputKeywords[i].Keyword; + sb += '\n'; + } + + document.getElementById("input").value = sb; + document.getElementById("numofkeywords").innerHTML = '' + outputKeywords.length + ' : ' + keywordsToDisplay.length; +} + +function FilterIfNotWorking() { + if (doWork == false) { + FilterAndDisplay(); + } +} + +function post_to_url(path, params, method) { + method = method || "post"; // Set method to post by default, if not specified. + + // The rest of this code assumes you are not using a library. + // It can be made less wordy if you use one. + var form = document.createElement("form"); + form.setAttribute("method", method); + form.setAttribute("action", path); + + for (var key in params) { + if (params.hasOwnProperty(key)) { + var hiddenField = document.createElement("input"); + hiddenField.setAttribute("type", "hidden"); + hiddenField.setAttribute("name", key); + hiddenField.setAttribute("value", params[key]); + + form.appendChild(hiddenField); + } + } + + document.body.appendChild(form); + form.submit(); +} + +function Download() { + var inputText = document.getElementById("input").value; + post_to_url('KSDownload.php', { + 'input_text': inputText + }, 'post'); +} + +$(document).ready(function() { + table = $('#outtable').DataTable({ + // "dom": '<"top"iflp<"clear">>rt<"bottom"ipB<"clear">>', + // responsive: true, + pageLength: 25, + // bAutoWidth: false, + // dom: 'lfrtipB', + dom: "<'row'<'col-sm-3'B><'col-sm-6'p><'col-sm-3'f>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-4'i><'col-sm-5'p><'col-sm-3'l>>", + buttons: ['copyHtml5','csvHtml5'] + // aaSorting: [], + // data: keywordsToDisplay + }); +} );