Skip to content

Commit

Permalink
M
Browse files Browse the repository at this point in the history
  • Loading branch information
diggs1711 committed Feb 14, 2017
1 parent e103daf commit 5292e30
Show file tree
Hide file tree
Showing 5 changed files with 471 additions and 1 deletion.
2 changes: 1 addition & 1 deletion webscraper/bets.json

Large diffs are not rendered by default.

122 changes: 122 additions & 0 deletions webscraper/geckodriver.log
Original file line number Diff line number Diff line change
Expand Up @@ -14406,3 +14406,125 @@ Full stack:
1486510789140 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1486510906893 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1486510906898 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487033422509 geckodriver INFO Listening on 127.0.0.1:52440
1487033423421 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.8xp1mmSvWYGr
1487033423423 geckodriver::marionette INFO Starting browser /usr/bin/firefox
1487033423497 geckodriver::marionette INFO Connecting to Marionette on localhost:41532
1487033427718 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487033427723 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487033427779 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487033427782 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487033429242 Marionette INFO Listening on port 41532
1487033429686 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487033429688 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487033429702 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487033429704 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
Vector smash protection is enabled.
JavaScript error: , line 0: Error: Permission denied to access property "href"
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
JavaScript error: https://members.bet365.com/Members/javascript/Release/swfobject_v0.js, line 1: Error: Permission denied to access property "href"
JavaScript error: https://www.bet365.com/home/js/globals_vA058cr.js, line 2: TypeError: $0i is undefined

(firefox:5903): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:5903): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:5903): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:5903): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:5903): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:5903): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed
JavaScript warning: https://www.bet365.com/betslip/javascript/min/3.0.8.0/betslip.js, line 2: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
JavaScript warning: https://members.bet365.com/Members/History/Scripts/js/jquery-1.10.2.min.js, line 1: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead

(firefox:5903): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:5903): GLib-GObject-WARNING **: /build/glib2.0-8EA4QF/glib2.0-2.48.1/./gobject/gsignal.c:3486: signal name 'selection_changed' is invalid for instance '0x93954a60' of type 'MaiAtkType139'
JavaScript warning: https://members.bet365.com/Members/History/Scripts/js/jquery-1.10.2.min.js, line 1: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
1487033898597 geckodriver INFO Listening on 127.0.0.1:33140
1487033899582 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.4YBzaNRbYM2P
1487033899585 geckodriver::marionette INFO Starting browser /usr/bin/firefox
1487033899595 geckodriver::marionette INFO Connecting to Marionette on localhost:46601
1487033901171 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487033901174 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487033901227 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487033901230 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487033902311 Marionette INFO Listening on port 46601
1487033902675 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487033902678 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487033902696 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487033902697 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
Vector smash protection is enabled.
JavaScript error: , line 0: Error: Permission denied to access property "href"
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
JavaScript error: https://members.bet365.com/Members/javascript/Release/swfobject_v0.js, line 1: Error: Permission denied to access property "href"
JavaScript error: https://www.bet365.com/home/js/globals_vA058cr.js, line 2: TypeError: $0i is undefined

(firefox:6125): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6125): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6125): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6125): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6125): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6125): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed
JavaScript warning: https://www.bet365.com/betslip/javascript/min/3.0.8.0/betslip.js, line 2: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
JavaScript warning: https://www.bet365.com/betslip/javascript/min/3.0.8.0/betslip.js, line 2: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
JavaScript warning: https://members.bet365.com/Members/History/Scripts/js/jquery-1.10.2.min.js, line 1: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead

(firefox:6125): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6125): GLib-GObject-WARNING **: /build/glib2.0-8EA4QF/glib2.0-2.48.1/./gobject/gsignal.c:3486: signal name 'selection_changed' is invalid for instance '0x9ef33f10' of type 'MaiAtkType139'
1487034014449 geckodriver INFO Listening on 127.0.0.1:34707
1487034015440 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.aq9BkriPLzQV
1487034015444 geckodriver::marionette INFO Starting browser /usr/bin/firefox
1487034015451 geckodriver::marionette INFO Connecting to Marionette on localhost:33546
1487034016943 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487034016946 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487034016989 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487034016991 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487034017956 Marionette INFO Listening on port 33546
1487034018305 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487034018309 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487034018323 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487034018324 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
Vector smash protection is enabled.
JavaScript error: , line 0: Error: Permission denied to access property "href"
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
JavaScript error: https://members.bet365.com/Members/javascript/Release/swfobject_v0.js, line 1: Error: Permission denied to access property "href"
JavaScript error: https://www.bet365.com/home/js/globals_vA058cr.js, line 2: TypeError: $0i is undefined

(firefox:6323): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6323): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6323): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6323): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6323): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6323): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed
JavaScript warning: https://www.bet365.com/betslip/javascript/min/3.0.8.0/betslip.js, line 2: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
JavaScript warning: https://www.bet365.com/betslip/javascript/min/3.0.8.0/betslip.js, line 2: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
JavaScript warning: https://members.bet365.com/Members/History/Scripts/js/jquery-1.10.2.min.js, line 1: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead

(firefox:6323): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'g_type_parent (interface_type) == G_TYPE_INTERFACE' failed

(firefox:6323): GLib-GObject-WARNING **: /build/glib2.0-8EA4QF/glib2.0-2.48.1/./gobject/gsignal.c:3486: signal name 'selection_changed' is invalid for instance '0x98adc100' of type 'MaiAtkType139'
JavaScript warning: https://members.bet365.com/Members/History/Scripts/js/jquery-1.10.2.min.js, line 1: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
*************************
A coding exception was thrown and uncaught in a Task.

Full message: TypeError: NetworkError when attempting to fetch resource.
Full stack:
*************************
1487034619818 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487034619822 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
1487034737808 addons.xpi WARN Add-on langpack-en-GB@firefox.mozilla.org is not compatible with application version.
1487034737813 addons.xpi WARN Add-on langpack-en-ZA@firefox.mozilla.org is not compatible with application version.
43 changes: 43 additions & 0 deletions webscraper/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>

<head>
<title>Bet Tracker</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>

<body>
<div class="header">
<div class="normalContentWidth">
<ul class="headerMenu">
<li class="parentMenuItem logo">Betting Account Manager</li>
<li class="parentMenuItem searchBar"></li>
</ul>
</div>
</div>
<div class="content">
<div class="column bets-list normalContentWidth">
<input type="file" class="file" value="Import" />
<table class="bets">
<thead>
<tr class="bet">
<td class="bet-date">Date</td>
<td class="bet-event">Event</td>
<td class="bet-result">Result</td>
<td class="bet-type">Market</td>
</tr>
</thead>
<tbody class="bet-body">
</tbody>
</table>
</div>
<div class="column results">
<div class="amount-staked">100</div>
<div class="amount-returned">100</div>
<div class="total-profit">100</div>
</div>
</div>
<script type="text/javascript" src="index.js"></script>
</body>

</html>
175 changes: 175 additions & 0 deletions webscraper/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
(function() {
var fileUpload = {
input: null,

init: function() {
this.initElements();
this.initListeners();
},

initElements: function(){
this.input = document.querySelector(".file");
},

initListeners: function() {
var self = this;

this.input.addEventListener('change', self.getData.bind(this));
},

getData: function(e) {
var fileReader = new FileReader();
fileReader.onload = this.onReaderLoad.bind(this);
fileReader.readAsText(e.target.files[0]);
},

onReaderLoad: function(e) {
var obj = JSON.parse(e.target.result);
this.extractData(obj.bets);
},

extractData: function(data) {
var self = this;

data.forEach( function(element, index) {
pubSub.publish("betLoaded", [element]);
pubSub.publish("calculateProfit", [element]);
});

console.log(betCalculator.profit);
console.log(betCalculator.bets);
}

};

var betCalculator = {
profit: 0.0,
stake: 0.0,
betReturn: 0.0,
bets: 0,

calculateProfit: function(bet) {

var stake = bet["bet_stake"];
var betReturn = bet["bet_return"];

this.bets += 1;
this.stake = parseFloat(stake);
this.betReturn = parseFloat(betReturn);

this.profit += (-this.stake + this.betReturn);
}

};

var betView = {
betResult : null,
betEvent: null,

init: function() {
this.initElements();
},

initElements: function() {
this.betResult = document.querySelector('.bet-date');
this.betEvent = document.querySelector('.bet-event');
},

addValuesToElements: function(e) {
var d = e['bet_date'];
var ev = e['bet_event'];
var result = e['bet_result'];

var tbdoy = document.querySelector('.bet-body');
var newRow = tbdoy.insertRow(tbdoy.rows.length);
newRow.className = "bet";

var dCell = newRow.insertCell(0);
var eCell = newRow.insertCell(1);
var rCell = newRow.insertCell(2);
var mCell = newRow.insertCell(3);

var dText = document.createTextNode(d);
dCell.className = "bet-result";

var s = ev.split("(");
var ev = s[0];
var betType = s[1].replace(")", "");

var eText = document.createTextNode(ev);
eCell.className = "bet-event";

var mText = document.createTextNode(betType);
mCell.className = "bet-type";

var rText =document.createTextNode(result);
if(result === "Won")
rCell.className = "bet-result won";
else if(result === "Lost" )
rCell.className = "bet-result lost";
else
rCell.className = "bet-result void"

dCell.appendChild(dText);
eCell.appendChild(eText);
rCell.appendChild(rText);
mCell.appendChild(mText);
},

createBetElement: function(r, e) {
var betDiv = document.createElement('tr');
var resultDiv = document.createElement('td');
var eventDiv = document.createElement('td');

resultDiv.innerText = r;
eventDiv.innerText = e;

betDiv.appendChild(resultDiv);
betDiv.appendChild(eventDiv);

return betDiv;
}
};

var betController = {

};

var betModel = {
bets: {}
}

var pubSub = {
cache: {
"betLoaded": [],
"calculateProfit": []
},

subscribe: function(e, fn, scope) {
var sub = this.cache[e];
if(!sub) return;

sub.push({
fn: fn,
scope: scope
});
},

publish: function(e, data) {
var event = this.cache[e];
if(!event) return;

event.forEach( function(el, index) {
el.fn.apply(el.scope, data || []);
});
}

}

fileUpload.init();
betView.init();

pubSub.subscribe("betLoaded", betView.addValuesToElements, betView);
pubSub.subscribe("calculateProfit", betCalculator.calculateProfit, betCalculator);

})();
Loading

0 comments on commit 5292e30

Please sign in to comment.