mirror of
https://github.com/wassname/keywordshitter2.git
synced 2026-06-27 16:10:23 +08:00
Added datatables, and better stemming
This commit is contained in:
+57
@@ -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-*
|
||||
@@ -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
|
||||
@@ -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"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<title>Keyword Shitter - The Bulk Keyword Tool</title>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap-theme.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/alertifyjs-alertify.js/1.0.8/css/alertify.css" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/s/bs/dt-1.10.10,b-1.1.0,b-html5-1.1.0,fh-3.1.0,kt-2.1.0,r-2.0.0,rr-1.1.0,se-1.1.0/datatables.min.css"/>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
|
||||
<img class="responsive text-center" style="max-height: 75px" src="bl.png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div id="numofkeywords"></div>
|
||||
<textarea id="input" rows="6" style="min-width: 100%"></textarea>
|
||||
|
||||
<a class="btn btn-info" id="startjob" onclick="StartJob();" type="button" value="Shit Keywords!">Shit Keywords!</a>
|
||||
<div id="container"></div>
|
||||
|
||||
<!-- For debugging -->
|
||||
<textarea id="queryoutput" style="display:none;"></textarea>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<textarea id="filter-positive" rows="3" onkeyup="FilterIfNotWorking()" placeholder="Positive Filter"></textarea>
|
||||
|
||||
<textarea id="filter-negative" rows="3" onkeyup="FilterIfNotWorking()" placeholder="Negative Filter"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table id="outtable" class=" table compact dt-responsive" cellspacing="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>id</th>
|
||||
<th>Keyword</th>
|
||||
<th title="Keyword length">Length</th>
|
||||
<th title="Searches per month">Searches</th>
|
||||
<th title="Cost per click ($US)">CPC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.10/js/jquery.js"></script>
|
||||
<script type="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/s/bs/jszip-2.5.0,dt-1.10.10,b-1.1.0,b-colvis-1.1.0,b-html5-1.1.0,b-print-1.1.0,cr-1.3.0,fh-3.1.0,kt-2.1.0,r-2.0.0,se-1.1.0/datatables.min.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/alertify.js/0.5.0/alertify.min.js"></script>
|
||||
<script type="text/javascript" src="main.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,149 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<link rel='stylesheet' type='text/css' href='' />
|
||||
<style>
|
||||
body, textarea {
|
||||
text-rendering:optimizeLegibility;
|
||||
background:#fff;
|
||||
font:normal 13px/15px 'Helvetica';
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
textarea {
|
||||
float:left;
|
||||
height:300px;
|
||||
width:140px;
|
||||
}
|
||||
#chart {
|
||||
float:left;
|
||||
}
|
||||
circle {
|
||||
fill:#CCF3FF;
|
||||
}
|
||||
text { fill: #000; }
|
||||
path.link {
|
||||
fill: none;
|
||||
stroke: #999;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<textarea id='input'></textarea>
|
||||
<div id='chart'></div>
|
||||
<script src="http://d3js.org/d3.v2.js"></script>
|
||||
<script>
|
||||
var m = [20, 120, 20, 120],
|
||||
w = 490 - m[1] - m[3],
|
||||
h = 300 - m[0] - m[2],
|
||||
i = 0,
|
||||
root;
|
||||
|
||||
var tree = d3.layout.tree()
|
||||
.size([h, w]);
|
||||
|
||||
var diagonal = d3.svg.diagonal()
|
||||
.projection(function(d) { return [d.y, d.x]; });
|
||||
|
||||
function d3ize(tree, n) {
|
||||
var nt = {name: n || ''};
|
||||
if (Object.keys(tree).length) {
|
||||
nt.children = [];
|
||||
for (var k in tree) {
|
||||
nt.children.push(d3ize(tree[k], k));
|
||||
}
|
||||
}
|
||||
return nt;
|
||||
}
|
||||
|
||||
function trie(keys) {
|
||||
var trie = {};
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var pos = trie;
|
||||
for (var j = 0; j < keys[i].length; j++) {
|
||||
if (pos[keys[i][j]] === undefined) {
|
||||
pos[keys[i][j]] = {};
|
||||
}
|
||||
pos = pos[keys[i][j]];
|
||||
}
|
||||
}
|
||||
return trie;
|
||||
}
|
||||
|
||||
var vis = d3.select("#chart").append("svg:svg")
|
||||
.attr("width", w + m[1] + m[3])
|
||||
.attr("height", h + m[0] + m[2])
|
||||
.append("svg:g")
|
||||
.attr("transform", "translate(" + m[3] + "," + m[0] + ")");
|
||||
|
||||
function update() {
|
||||
var duration = d3.event && d3.event.altKey ? 5000 : 500;
|
||||
|
||||
// Compute the new tree layout.
|
||||
var nodes = tree.nodes(root).reverse();
|
||||
|
||||
// Normalize for fixed-depth.
|
||||
nodes.forEach(function(d) { d.y = d.depth * 20; });
|
||||
|
||||
// Update the nodes…
|
||||
var node = vis.selectAll("g.node")
|
||||
.data(nodes, function(d) { return d.id || (d.id = ++i); });
|
||||
|
||||
// Enter any new nodes at the parent's previous position.
|
||||
var nodeEnter = node.enter().append("svg:g")
|
||||
.attr("class", "node");
|
||||
|
||||
nodeEnter.append("svg:circle");
|
||||
|
||||
nodeEnter.append("svg:text")
|
||||
.attr("x", function(d) { return 0; })
|
||||
.attr("dy", function(d) { return 3; })
|
||||
.attr("text-anchor", function(d) { return "middle"; })
|
||||
.text(function(d) { return d.name; });
|
||||
|
||||
// Transition nodes to their new position.
|
||||
var nodeUpdate = node.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
|
||||
|
||||
nodeUpdate.select("circle")
|
||||
.attr("r", 9);
|
||||
|
||||
var link = vis.selectAll("path.link")
|
||||
.data(tree.links(nodes), function(d) { return d.target.id; });
|
||||
|
||||
link.enter().insert("svg:path", "g")
|
||||
.attr("class", "link")
|
||||
.attr("d", diagonal);
|
||||
|
||||
link.transition()
|
||||
.duration(duration)
|
||||
.attr("d", diagonal);
|
||||
|
||||
link.exit().remove();
|
||||
node.exit().remove();
|
||||
}
|
||||
|
||||
function run(value) {
|
||||
root = d3ize(trie(value.split('\n')));
|
||||
root.x0 = h / 2;
|
||||
root.y0 = 0;
|
||||
update(root);
|
||||
}
|
||||
|
||||
d3.select('#input').on('keyup', function() {
|
||||
run(this.value);
|
||||
});
|
||||
|
||||
sample_text = 'type\nhere';
|
||||
|
||||
var interi = 0, inter = window.setInterval(function() {
|
||||
d3.select('#input').property('value', sample_text.slice(0, interi));
|
||||
run(sample_text.slice(0, interi));
|
||||
interi++;
|
||||
if (interi > sample_text.length) window.clearInterval(inter);
|
||||
}, 100);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+270
@@ -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
|
||||
});
|
||||
} );
|
||||
Reference in New Issue
Block a user