Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Commit

Permalink
şu andan sonra gereksiz olan bot'lar silindi
Browse files Browse the repository at this point in the history
  • Loading branch information
abdurrahmanekr committed Sep 12, 2018
1 parent 560acfe commit ff2c4c8
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 180 deletions.
66 changes: 0 additions & 66 deletions aws.js

This file was deleted.

1 change: 0 additions & 1 deletion constants.js
Expand Up @@ -3,7 +3,6 @@ const path = require('path');
module.exports = {
API_URL: "http://www.tdk.org.tr/index.php?option=com_gts&arama=gts&kelime=WORD",
TDK_WORD_LIST_URL: "http://tdk.gov.tr/index.php?option=com_yazimkilavuzu&view=yazimkilavuzu&kategori1=yazim_listeli&ayn1=bas&kelime1=WORD&sayfa1=PAGE",
AWS_API_URL: "https://nnv7qx39h3.execute-api.us-east-1.amazonaws.com/dev/getWord/?word=WORD",
WORDS_DIR: path.join(__dirname, 'words'),
WORDS_JSON_DIR: path.join(__dirname, 'words_json'),
};
66 changes: 0 additions & 66 deletions helpers/WordService.js
Expand Up @@ -3,7 +3,6 @@ const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
const {
API_URL,
TDK_WORD_LIST_URL,
AWS_API_URL,
WORDS_DIR,
} = require('../constants');

Expand Down Expand Up @@ -67,71 +66,6 @@ const WordService = {
});
},

/*
* AWS üzerinde açık olan servise istek atar ve kaydedilmesini sağlar
* @param {string} word - kaydedilecek gelime
*/
saveWord: (word) => {
return new Promise((resolve, reject) => {
var errorCount = 0;

var sendError = () => {
reject(new NE.HttpException('AWS request error.', 500));
};

var sendRequest = () => {
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () {
if (this.readyState == 4) {
if (this.status === 200) {
resolve(xhr.responseText);
}
else if (this.status === 404) {
resolve("[]");
}
else {
console.log('AWS request error, Trying again.');
if (errorCount++ < 10) {
setTimeout(() => {
sendRequest();
}, 5500);
}
else {
sendError();
}
}
}
});

xhr.onerror = function(err) {
console.log('AWS request error, Trying again.', err);
if (errorCount++ < 10) {
setTimeout(() => {
sendRequest();
}, 5500);
}
else {
sendError();
}
};

const URL = AWS_API_URL.replace('WORD', encodeURI(word));

xhr.open("GET", URL);

console.log(word, URL);

xhr.send(data);
};

sendRequest();

});
},

/*
* Tdk'nın sitesinden getirilen raw html değerinin içinden kelimeye ait tüm özellikleri getirir
* @param {string} raw - tdk kelime sayfasından gelen raw html değer
Expand Down
47 changes: 0 additions & 47 deletions index.js

This file was deleted.

0 comments on commit ff2c4c8

Please sign in to comment.