Skip to content

Commit

Permalink
VERSION: to 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fega committed Mar 8, 2017
1 parent 1ed218e commit bd7048a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
18 changes: 7 additions & 11 deletions lib/lib/process-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,26 @@ module.exports = (html) => {
result.word = $('h3.headerWord').text()
result.pronWR = $('span#pronWR').text()
result.audio = $('div#listen_widget audio source')
.map(function (i, el) {
return $(this).attr('src')
})
.map(function (i, el) { return $(this).attr('src') })
.get()

var tables = $('table.WRD')
.map(function (i, el) { // maps each table
return $(this).html()
})
.map(function (i, el) { return $(this).html() })
.get()

result.translations = tables.map(WRDtableMap)

// var body = Object.keys($("table.WRD")[0]["attribs"]['class'])
console.log(result)
return result
}
/**
* Parses the a table.WRD html element and return it as a json
* @param {String} html table.WRD html
* @return {Object} table parsed
*/
function WRDtableMap (html) {
var $ = cheerio.load(html)
var result = {}
result.title = ''
result.translations = []


$('tr').map(function (i, el) {
var element = $(this)
var id = element.attr('id')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wordreference-api",
"version": "0.0.0",
"version": "1.0.0",
"description": "An api to use the worldreference.com information",
"homepage": "",
"author": {
Expand Down

0 comments on commit bd7048a

Please sign in to comment.