jsonify-my-table

Convert a HTML table to JSON
git clone http://git.hanabi.in/repos/jsonify-my-table.git
Log | Files | Refs | LICENSE

commit 15d51f46a84fe6f8aa8683df96636a9e5fe08491
parent cc28b6c54e0f84235f5a1fc5b5f245a481535a91
Author: Agastya Chandrakant <acagastya@outlook.com>
Date:   Thu, 13 Jun 2019 15:31:20 +0530

Add all files
Diffstat:
MLICENSE | 3++-
AREADME.MD | 46++++++++++++++++++++++++++++++++++++++++++++++
MREADME.md | 3+--
Apackage.json | 23+++++++++++++++++++++++
Atabl2.json.min.js | 2++
Atable.html | 1276+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atable2json.js | 34++++++++++++++++++++++++++++++++++
7 files changed, 1384 insertions(+), 3 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +\ No newline at end of file diff --git a/README.MD b/README.MD @@ -0,0 +1,46 @@ +# table2json + +Convert a HTML table to JSON. Actually, to an array of JSON objects. + +## Usage + +Consider a HTML table with `id=myTable`. + +```html +<table id="myTable"> + ... +</table> +``` + +To convert it to an array of JSON objects: + +```javascript +const myTableObj = new table2json("myTable"); +myTableObj.res; // array of JSON objects. +``` + +`table2json` class accepts one parameter; the table id. + +## Data members + +In the above example, `myTableObj` contains following data members: + +- **`res`** &mdash; the array containing JSON objects. +- `headers` &mdash; the keys in the objects (also, the table headers). +- <small>`table`</small> &mdash; this one is the selection of table, in this case `table#myTable`. + +- [OPTIONAL] `error` &mdash; a flag which indicates if an error was occurred. + +## Errors + +1. If the `id` was not found in the `document`. +2. If the specified `id` is not of a table. +3. If the headers repeat. + +## Note + +Use this for the client-side JavaScript. Though this module is published on `npm`, it can not run on server-side JavaScript. This is because it makes use of `document`, which is not available in node, as is. + +To add it in the `<script>` tag, make use of [Unpkg](https://unpkg.com "UNPKG"). + +**Example:** `<script src="unpkg.com/table2json@latest/table2json.min.js"></script>` diff --git a/README.md b/README.md @@ -1,2 +1 @@ -# table2json -Convert a HTML table to JSON +table2json diff --git a/package.json b/package.json @@ -0,0 +1,23 @@ +{ + "name": "table2json", + "version": "1.0.0", + "description": "Convert a HTML table to JSON", + "main": "table2json.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/acagastya/table2json.git" + }, + "keywords": [ + "table", + "json" + ], + "author": "Agastya Chandrakant", + "license": "BSD-3-Clause", + "bugs": { + "url": "https://github.com/acagastya/table2json/issues" + }, + "homepage": "https://github.com/acagastya/table2json#readme" +} diff --git a/tabl2.json.min.js b/tabl2.json.min.js @@ -0,0 +1 @@ +class table2json{constructor(tableID){this.table=document.getElementById(tableID);if(!this.table){this.error=true;console.error(`Table not found.`);return}this.headers=[];for(let i=0;i<this.table.rows[0].cells.length;i+=1){this.headers.push(this.table.rows[0].cells[i].innerText)}if(this.headers.length>new Set(this.headers).size){this.error=true;console.error(`Headers repeat.`);return}this.res=[];for(let i=1;i<this.table.rows.length;i+=1){let values=[];for(let j=0;j<this.table.rows[i].cells.length;j+=1){values.push(this.table.rows[i].cells[j].innerText)}let obj={};this.headers.forEach((el,index)=>(obj={...obj,[el.valueOf()]:values[index]}));this.res.push(obj)}}} +\ No newline at end of file diff --git a/table.html b/table.html @@ -0,0 +1,1275 @@ +<table id="the_list" data-year="2019" data-uri="athletes" data-type="person" data-subtype="person" data-zone="profile" + data-search-fields="[&quot;name&quot;]"> + + <thead> + <tr> + <th></th> + + + + <th data-field="position"><a>Rank</a></th> + + + + <th data-field="name"><a>Name</a></th> + + + + <th data-field="pay"><a>Pay</a></th> + + + + <th data-field="salary"><a>Salary/Winnings</a></th> + + + + <th data-field="endorsements"><a>Endorsements</a></th> + + + + <th data-field="source"><a>Sport</a></th> + + </tr> + </thead> + + <tbody id="list-table-body"> + + <tr class="data"> + <td class="image"><a href="/profile/lionel-messi/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea7bb4c687b0008593c0a/200x200.jpg?background=000000&amp;cropX1=1554&amp;cropX2=2474&amp;cropY1=240&amp;cropY2=1159" + alt=""></a></td> + <td class="rank">#1 </td> + <td class="name"><a href="/profile/lionel-messi/?list=athletes" class="exit_trigger_set">Lionel Messi</a></td> + <td>$127 M</td> + <td>$92 M</td> + <td>$35 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/cristiano-ronaldo/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe985e4c687b0008593a14/200x200.jpg?background=000000&amp;cropX1=474&amp;cropX2=1931&amp;cropY1=166&amp;cropY2=1622" + alt=""></a></td> + <td class="rank">#2 </td> + <td class="name"><a href="/profile/cristiano-ronaldo/?list=athletes" class="exit_trigger_set">Cristiano + Ronaldo</a></td> + <td>$109 M</td> + <td>$65 M</td> + <td>$44 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/neymar/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeaad0142c50000a328969/200x200.jpg?background=000000&amp;cropX1=683&amp;cropX2=3482&amp;cropY1=69&amp;cropY2=2868" + alt=""></a></td> + <td class="rank">#3 </td> + <td class="name"><a href="/profile/neymar/?list=athletes" class="exit_trigger_set">Neymar</a></td> + <td>$105 M</td> + <td>$75 M</td> + <td>$30 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/canelo-alvarez/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6bcd4c687b0008592ffb/200x200.jpg?background=000000&amp;cropX1=929&amp;cropX2=2247&amp;cropY1=184&amp;cropY2=1502" + alt=""></a></td> + <td class="rank">#4 </td> + <td class="name"><a href="/profile/canelo-alvarez/?list=athletes" class="exit_trigger_set">Canelo Alvarez</a></td> + <td>$94 M</td> + <td>$92 M</td> + <td>$2 M</td> + <td>Boxing</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/roger-federer/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5b156893a7ea436b547f54f2/200x200.jpg?background=000000&amp;cropX1=1691&amp;cropX2=2364&amp;cropY1=1265&amp;cropY2=1938" + alt=""></a></td> + <td class="rank">#5 </td> + <td class="name"><a href="/profile/roger-federer/?list=athletes" class="exit_trigger_set">Roger Federer</a></td> + <td>$93.4 M</td> + <td>$7.4 M</td> + <td>$86 M</td> + <td>Tennis</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/russell-wilson/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeacf634a5c4000847fd42/200x200.jpg?background=000000&amp;cropX1=314&amp;cropX2=1286&amp;cropY1=155&amp;cropY2=1127" + alt=""></a></td> + <td class="rank">#6 </td> + <td class="name"><a href="/profile/russell-wilson/?list=athletes" class="exit_trigger_set">Russell Wilson</a></td> + <td>$89.5 M</td> + <td>$80.5 M</td> + <td>$9 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/aaron-rodgers/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe61c7142c50000a327873/200x200.jpg?background=000000&amp;cropX1=1246&amp;cropX2=3588&amp;cropY1=100&amp;cropY2=2441" + alt=""></a></td> + <td class="rank">#7 </td> + <td class="name"><a href="/profile/aaron-rodgers/?list=athletes" class="exit_trigger_set">Aaron Rodgers</a></td> + <td>$89.3 M</td> + <td>$80.3 M</td> + <td>$9 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/lebron-james/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea6cc142c50000a32881f/200x200.jpg?background=000000&amp;cropX1=1180&amp;cropX2=3728&amp;cropY1=256&amp;cropY2=2805" + alt=""></a></td> + <td class="rank">#8 </td> + <td class="name"><a href="/profile/lebron-james/?list=athletes" class="exit_trigger_set">LeBron James</a></td> + <td>$89 M</td> + <td>$36 M</td> + <td>$53 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/stephen-curry/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5b156e3831358e612fbb15f7/200x200.jpg?background=000000&amp;cropX1=399&amp;cropX2=2400&amp;cropY1=0&amp;cropY2=2000" + alt=""></a></td> + <td class="rank">#9 </td> + <td class="name"><a href="/profile/stephen-curry/?list=athletes" class="exit_trigger_set">Stephen Curry</a></td> + <td>$79.8 M</td> + <td>$37.8 M</td> + <td>$42 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/kevin-durant/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea52234a5c4000847fbed/200x200.jpg?background=000000&amp;cropX1=574&amp;cropX2=2223&amp;cropY1=724&amp;cropY2=2374" + alt=""></a></td> + <td class="rank">#10 </td> + <td class="name"><a href="/profile/kevin-durant/?list=athletes" class="exit_trigger_set">Kevin Durant</a></td> + <td>$65.4 M</td> + <td>$30.4 M</td> + <td>$35 M</td> + <td>Basketball</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_1"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/tiger-woods/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeb0e834a5c4000847fe33/200x200.jpg?background=000000&amp;cropX1=131&amp;cropX2=2141&amp;cropY1=93&amp;cropY2=2104" + alt=""></a></td> + <td class="rank">#11 </td> + <td class="name"><a href="/profile/tiger-woods/?list=athletes" class="exit_trigger_set">Tiger Woods</a></td> + <td>$63.9 M</td> + <td>$9.9 M</td> + <td>$54 M</td> + <td>Golf</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/ben-roethlisberger/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe67f44c687b0008592f1f/200x200.jpg?background=000000&amp;cropX1=555&amp;cropX2=2996&amp;cropY1=26&amp;cropY2=2467" + alt=""></a></td> + <td class="rank">#12 </td> + <td class="name"><a href="/profile/ben-roethlisberger/?list=athletes" class="exit_trigger_set">Ben + Roethlisberger</a></td> + <td>$55.5 M</td> + <td>$54.5 M</td> + <td>$1 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/lewis-hamilton/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea740142c50000a328877/200x200.jpg?background=000000&amp;cropX1=1397&amp;cropX2=3536&amp;cropY1=134&amp;cropY2=2272" + alt=""></a></td> + <td class="rank">#13 </td> + <td class="name"><a href="/profile/lewis-hamilton/?list=athletes" class="exit_trigger_set">Lewis Hamilton</a></td> + <td>$55 M</td> + <td>$45 M</td> + <td>$10 M</td> + <td>Auto Racing</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/anthony-joshua/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe66fa4c687b0008592ec8/200x200.jpg?background=000000&amp;cropX1=120&amp;cropX2=2551&amp;cropY1=255&amp;cropY2=2687" + alt=""></a></td> + <td class="rank">#13 </td> + <td class="name"><a href="/profile/anthony-joshua/?list=athletes" class="exit_trigger_set">Anthony Joshua</a></td> + <td>$55 M</td> + <td>$45 M</td> + <td>$10 M</td> + <td>Boxing</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/khalil-mack/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6e024c687b0008593043/200x200.jpg?background=000000&amp;cropX1=1101&amp;cropX2=4230&amp;cropY1=253&amp;cropY2=3380" + alt=""></a></td> + <td class="rank">#13 </td> + <td class="name"><a href="/profile/khalil-mack/?list=athletes" class="exit_trigger_set">Khalil Mack</a></td> + <td>$55 M</td> + <td>$54 M</td> + <td>$1 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/russell-westbrook/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeac2634a5c4000847fd21/200x200.jpg?background=000000&amp;cropX1=272&amp;cropX2=2772&amp;cropY1=858&amp;cropY2=3360" + alt=""></a></td> + <td class="rank">#16 </td> + <td class="name"><a href="/profile/russell-westbrook/?list=athletes" class="exit_trigger_set">Russell + Westbrook</a></td> + <td>$53.7 M</td> + <td>$35.7 M</td> + <td>$18 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/novak-djokovic/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/593694044bbe6f1b730b2f7f/200x200.jpg?background=000000&amp;cropX1=957&amp;cropX2=2199&amp;cropY1=638&amp;cropY2=1879" + alt=""></a></td> + <td class="rank">#17 </td> + <td class="name"><a href="/profile/novak-djokovic/?list=athletes" class="exit_trigger_set">Novak Djokovic</a></td> + <td>$50.6 M</td> + <td>$20.6 M</td> + <td>$30 M</td> + <td>Tennis</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/mike-trout/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6e6c4c687b0008593078/200x200.jpg?background=000000&amp;cropX1=526&amp;cropX2=2241&amp;cropY1=121&amp;cropY2=1835" + alt=""></a></td> + <td class="rank">#17 </td> + <td class="name"><a href="/profile/mike-trout/?list=athletes" class="exit_trigger_set">Mike Trout</a></td> + <td>$50.6 M</td> + <td>$47.6 M</td> + <td>$3 M</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/phil-mickelson/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeab604c687b0008593cdd/200x200.jpg?background=000000&amp;cropX1=24&amp;cropX2=2110&amp;cropY1=28&amp;cropY2=2113" + alt=""></a></td> + <td class="rank">#19 </td> + <td class="name"><a href="/profile/phil-mickelson/?list=athletes" class="exit_trigger_set">Phil Mickelson</a></td> + <td>$48.4 M</td> + <td>$12.4 M</td> + <td>$36 M</td> + <td>Golf</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/james-harden/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea19734a5c4000847fb8a/200x200.jpg?background=000000&amp;cropX1=749&amp;cropX2=4156&amp;cropY1=436&amp;cropY2=3840" + alt=""></a></td> + <td class="rank">#20 </td> + <td class="name"><a href="/profile/james-harden/?list=athletes" class="exit_trigger_set">James Harden</a></td> + <td>$47.7 M</td> + <td>$30.7 M</td> + <td>$17 M</td> + <td>Basketball</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_2"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/conor-mcgregor/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6efc34a5c4000847f16a/200x200.jpg?background=000000&amp;cropX1=1251&amp;cropX2=4026&amp;cropY1=875&amp;cropY2=3648" + alt=""></a></td> + <td class="rank">#21 </td> + <td class="name"><a href="/profile/conor-mcgregor/?list=athletes" class="exit_trigger_set">Conor McGregor</a></td> + <td>$47 M</td> + <td>$32 M</td> + <td>$15 M</td> + <td>Mixed Martial Arts</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/demarcus-lawrence/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6f85142c50000a327c02/200x200.jpg?background=000000&amp;cropX1=814&amp;cropX2=4119&amp;cropY1=0&amp;cropY2=3303" + alt=""></a></td> + <td class="rank">#22 </td> + <td class="name"><a href="/profile/demarcus-lawrence/?list=athletes" class="exit_trigger_set">DeMarcus + Lawrence</a></td> + <td>$46.9 M</td> + <td>$46.8 M</td> + <td>$150 K</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/bryce-harper/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6b7f34a5c4000847f0ac/200x200.jpg?background=000000&amp;cropX1=904&amp;cropX2=2420&amp;cropY1=163&amp;cropY2=1680" + alt=""></a></td> + <td class="rank">#23 </td> + <td class="name"><a href="/profile/bryce-harper/?list=athletes" class="exit_trigger_set">Bryce Harper</a></td> + <td>$44.5 M</td> + <td>$38 M</td> + <td>$6.5 M</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/chris-paul/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6ce74c687b0008593025/200x200.jpg?background=000000&amp;cropX1=1171&amp;cropX2=2948&amp;cropY1=52&amp;cropY2=1828" + alt=""></a></td> + <td class="rank">#24 </td> + <td class="name"><a href="/profile/chris-paul/?list=athletes" class="exit_trigger_set">Chris Paul</a></td> + <td>$43.8 M</td> + <td>$35.8 M</td> + <td>$8 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/kyrie-irving/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe701b4c687b00085930c8/200x200.jpg?background=000000&amp;cropX1=531&amp;cropX2=1859&amp;cropY1=242&amp;cropY2=1570" + alt=""></a></td> + <td class="rank">#25 </td> + <td class="name"><a href="/profile/kyrie-irving/?list=athletes" class="exit_trigger_set">Kyrie Irving</a></td> + <td>$43.3 M</td> + <td>$20.3 M</td> + <td>$23 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/giannis-antetokounmpo/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea045142c50000a328704/200x200.jpg?background=000000&amp;cropX1=1243&amp;cropX2=3801&amp;cropY1=0&amp;cropY2=2556" + alt=""></a></td> + <td class="rank">#26 </td> + <td class="name"><a href="/profile/giannis-antetokounmpo/?list=athletes" class="exit_trigger_set">Giannis + Antetokounmpo</a></td> + <td>$43.2 M</td> + <td>$24.2 M</td> + <td>$19 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/drew-brees/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe9d8f4c687b0008593a85/200x200.jpg?background=000000&amp;cropX1=2134&amp;cropX2=3403&amp;cropY1=91&amp;cropY2=1360" + alt=""></a></td> + <td class="rank">#27 </td> + <td class="name"><a href="/profile/drew-brees/?list=athletes" class="exit_trigger_set">Drew Brees</a></td> + <td>$42.4 M</td> + <td>$26.4 M</td> + <td>$16 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/aaron-donald/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6166142c50000a327841/200x200.jpg?background=000000&amp;cropX1=754&amp;cropX2=3887&amp;cropY1=7&amp;cropY2=3139" + alt=""></a></td> + <td class="rank">#28 </td> + <td class="name"><a href="/profile/aaron-donald/?list=athletes" class="exit_trigger_set">Aaron Donald</a></td> + <td>$41.4 M</td> + <td>$40.9 M</td> + <td>$500 K</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/damian-lillard/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe99794c687b0008593a36/200x200.jpg?background=000000&amp;cropX1=419&amp;cropX2=1977&amp;cropY1=238&amp;cropY2=1798" + alt=""></a></td> + <td class="rank">#29 </td> + <td class="name"><a href="/profile/damian-lillard/?list=athletes" class="exit_trigger_set">Damian Lillard</a></td> + <td>$41.1 M</td> + <td>$28.1 M</td> + <td>$13 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/sebastian-vettel/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeaf1334a5c4000847fde2/200x200.jpg?background=000000&amp;cropX1=1024&amp;cropX2=3987&amp;cropY1=404&amp;cropY2=3365" + alt=""></a></td> + <td class="rank">#30 </td> + <td class="name"><a href="/profile/sebastian-vettel/?list=athletes" class="exit_trigger_set">Sebastian Vettel</a> + </td> + <td>$40.3 M</td> + <td>$40 M</td> + <td>$300 K</td> + <td>Auto Racing</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_3"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/blake-griffin/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe68554c687b0008592f74/200x200.jpg?background=000000&amp;cropX1=510&amp;cropX2=2246&amp;cropY1=64&amp;cropY2=1801" + alt=""></a></td> + <td class="rank">#31 </td> + <td class="name"><a href="/profile/blake-griffin/?list=athletes" class="exit_trigger_set">Blake Griffin</a></td> + <td>$39.1 M</td> + <td>$32.1 M</td> + <td>$7 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/rory-mcilroy/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeabd834a5c4000847fd0a/200x200.jpg?background=000000&amp;cropX1=629&amp;cropX2=1941&amp;cropY1=137&amp;cropY2=1448" + alt=""></a></td> + <td class="rank">#32 </td> + <td class="name"><a href="/profile/rory-mcilroy/?list=athletes" class="exit_trigger_set">Rory McIlroy</a></td> + <td>$39 M</td> + <td>$8 M</td> + <td>$31 M</td> + <td>Golf</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/paul-george/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe713834a5c4000847f18e/200x200.jpg?background=000000&amp;cropX1=2029&amp;cropX2=5141&amp;cropY1=450&amp;cropY2=3560" + alt=""></a></td> + <td class="rank">#33 </td> + <td class="name"><a href="/profile/paul-george/?list=athletes" class="exit_trigger_set">Paul George</a></td> + <td>$38.6 M</td> + <td>$30.6 M</td> + <td>$8 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/brandin-cooks/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6afc4c687b0008592fb5/200x200.jpg?background=000000&amp;cropX1=367&amp;cropX2=3257&amp;cropY1=12&amp;cropY2=2900" + alt=""></a></td> + <td class="rank">#34 </td> + <td class="name"><a href="/profile/brandin-cooks/?list=athletes" class="exit_trigger_set">Brandin Cooks</a></td> + <td>$38 M</td> + <td>$37.5 M</td> + <td>$500 K</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/kei-nishikori/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5b15462831358e612fbb0d6b/200x200.jpg?background=000000&amp;cropX1=674&amp;cropX2=2331&amp;cropY1=201&amp;cropY2=1857" + alt=""></a></td> + <td class="rank">#35 </td> + <td class="name"><a href="/profile/kei-nishikori/?list=athletes" class="exit_trigger_set">Kei Nishikori</a></td> + <td>$37.3 M</td> + <td>$4.3 M</td> + <td>$33 M</td> + <td>Tennis</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/nick-foles/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe72534c687b000859318e/200x200.jpg?background=000000&amp;cropX1=915&amp;cropX2=3277&amp;cropY1=238&amp;cropY2=2599" + alt=""></a></td> + <td class="rank">#36 </td> + <td class="name"><a href="/profile/nick-foles/?list=athletes" class="exit_trigger_set">Nick Foles</a></td> + <td>$35.8 M</td> + <td>$33.8 M</td> + <td>$2 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/rafael-nadal/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5b1567d6a7ea436b547f54ce/200x200.jpg?background=000000&amp;cropX1=1174&amp;cropX2=2630&amp;cropY1=589&amp;cropY2=2045" + alt=""></a></td> + <td class="rank">#37 </td> + <td class="name"><a href="/profile/rafael-nadal/?list=athletes" class="exit_trigger_set">Rafael Nadal</a></td> + <td>$35 M</td> + <td>$9 M</td> + <td>$26 M</td> + <td>Tennis</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/manny-machado/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cc9ac3031358e5bca39c404/200x200.jpg?background=000000&amp;cropX1=737&amp;cropX2=2537&amp;cropY1=0&amp;cropY2=1801" + alt=""></a></td> + <td class="rank">#38 </td> + <td class="name"><a href="/profile/manny-machado/?list=athletes" class="exit_trigger_set">Manny Machado</a></td> + <td>$34.8 M</td> + <td>$34.3 M</td> + <td>$500 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/anthony-davis/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe668c142c50000a327a30/200x200.jpg?background=000000&amp;cropX1=1753&amp;cropX2=3744&amp;cropY1=140&amp;cropY2=2130" + alt=""></a></td> + <td class="rank">#39 </td> + <td class="name"><a href="/profile/anthony-davis/?list=athletes" class="exit_trigger_set">Anthony Davis</a></td> + <td>$34.6 M</td> + <td>$25.6 M</td> + <td>$9 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/gordon-hayward/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe7f114c687b00085933f2/200x200.jpg?background=000000&amp;cropX1=1256&amp;cropX2=2847&amp;cropY1=933&amp;cropY2=2522" + alt=""></a></td> + <td class="rank">#40 </td> + <td class="name"><a href="/profile/gordon-hayward/?list=athletes" class="exit_trigger_set">Gordon Hayward</a></td> + <td>$34.3 M</td> + <td>$31.3 M</td> + <td>$3 M</td> + <td>Basketball</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_4"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/klay-thompson/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe7f5f4c687b0008593408/200x200.jpg?background=000000&amp;cropX1=742&amp;cropX2=2009&amp;cropY1=571&amp;cropY2=1840" + alt=""></a></td> + <td class="rank">#40 </td> + <td class="name"><a href="/profile/klay-thompson/?list=athletes" class="exit_trigger_set">Klay Thompson</a></td> + <td>$34.3 M</td> + <td>$19.3 M</td> + <td>$15 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/carmelo-anthony/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6c4a34a5c4000847f0fc/200x200.jpg?background=000000&amp;cropX1=1014&amp;cropX2=3148&amp;cropY1=37&amp;cropY2=2170" + alt=""></a></td> + <td class="rank">#42 </td> + <td class="name"><a href="/profile/carmelo-anthony/?list=athletes" class="exit_trigger_set">Carmelo Anthony</a> + </td> + <td>$34 M</td> + <td>$28 M</td> + <td>$6 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/kyle-lowry/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe810734a5c4000847f537/200x200.jpg?background=000000&amp;cropX1=649&amp;cropX2=2651&amp;cropY1=64&amp;cropY2=2065" + alt=""></a></td> + <td class="rank">#43 </td> + <td class="name"><a href="/profile/kyle-lowry/?list=athletes" class="exit_trigger_set">Kyle Lowry</a></td> + <td>$33.8 M</td> + <td>$32.3 M</td> + <td>$1.5 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/paul-pogba/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe81e734a5c4000847f55a/200x200.jpg?background=000000&amp;cropX1=320&amp;cropX2=1540&amp;cropY1=172&amp;cropY2=1393" + alt=""></a></td> + <td class="rank">#44 </td> + <td class="name"><a href="/profile/paul-pogba/?list=athletes" class="exit_trigger_set">Paul Pogba</a></td> + <td>$33 M</td> + <td>$29 M</td> + <td>$4 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/demar-derozan/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe826734a5c4000847f56e/200x200.jpg?background=000000&amp;cropX1=1032&amp;cropX2=3832&amp;cropY1=12&amp;cropY2=2813" + alt=""></a></td> + <td class="rank">#45 </td> + <td class="name"><a href="/profile/demar-derozan/?list=athletes" class="exit_trigger_set">DeMar DeRozan</a></td> + <td>$32.8 M</td> + <td>$27.8 M</td> + <td>$5 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/andres-iniesta/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe5df134a5c4000847ed0d/200x200.jpg?background=000000&amp;cropX1=1066&amp;cropX2=4272&amp;cropY1=509&amp;cropY2=3712" + alt=""></a></td> + <td class="rank">#46 </td> + <td class="name"><a href="/profile/andres-iniesta/?list=athletes" class="exit_trigger_set">Andres Iniesta</a></td> + <td>$32.5 M</td> + <td>$30 M</td> + <td>$2.5 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/justin-rose/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea3f7142c50000a32878d/200x200.jpg?background=000000&amp;cropX1=108&amp;cropX2=1780&amp;cropY1=333&amp;cropY2=2004" + alt=""></a></td> + <td class="rank">#47 </td> + <td class="name"><a href="/profile/justin-rose/?list=athletes" class="exit_trigger_set">Justin Rose</a></td> + <td>$32.4 M</td> + <td>$18.4 M</td> + <td>$14 M</td> + <td>Golf</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/joel-embiid/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe830f4c687b00085934a2/200x200.jpg?background=000000&amp;cropX1=515&amp;cropX2=3577&amp;cropY1=0&amp;cropY2=3065" + alt=""></a></td> + <td class="rank">#48 </td> + <td class="name"><a href="/profile/joel-embiid/?list=athletes" class="exit_trigger_set">Joel Embiid</a></td> + <td>$32.1 M</td> + <td>$25.6 M</td> + <td>$6.5 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/al-horford/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe6223142c50000a32789e/200x200.jpg?background=000000&amp;cropX1=739&amp;cropX2=3092&amp;cropY1=756&amp;cropY2=3110" + alt=""></a></td> + <td class="rank">#49 </td> + <td class="name"><a href="/profile/al-horford/?list=athletes" class="exit_trigger_set">Al Horford</a></td> + <td>$32 M</td> + <td>$29 M</td> + <td>$3 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/david-price/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8495142c50000a3280ba/200x200.jpg?background=000000&amp;cropX1=382&amp;cropX2=2254&amp;cropY1=250&amp;cropY2=2122" + alt=""></a></td> + <td class="rank">#50 </td> + <td class="name"><a href="/profile/david-price/?list=athletes" class="exit_trigger_set">David Price</a></td> + <td>$31.7 M</td> + <td>$30.7 M</td> + <td>$950 K</td> + <td>Baseball</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_5"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/mike-conley-jr/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe84f64c687b000859354c/200x200.jpg?background=000000&amp;cropX1=278&amp;cropX2=2388&amp;cropY1=208&amp;cropY2=2317" + alt=""></a></td> + <td class="rank">#51 </td> + <td class="name"><a href="/profile/mike-conley-jr/?list=athletes" class="exit_trigger_set">Mike Conley, Jr.</a> + </td> + <td>$31.5 M</td> + <td>$30.5 M</td> + <td>$1 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/jordan-spieth/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea2c14c687b0008593b3c/200x200.jpg?background=000000&amp;cropX1=1193&amp;cropX2=3832&amp;cropY1=184&amp;cropY2=2824" + alt=""></a></td> + <td class="rank">#52 </td> + <td class="name"><a href="/profile/jordan-spieth/?list=athletes" class="exit_trigger_set">Jordan Spieth</a></td> + <td>$31.1 M</td> + <td>$2.1 M</td> + <td>$29 M</td> + <td>Golf</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/alexis-sanchez/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe5d5d34a5c4000847ecc0/200x200.jpg?background=000000&amp;cropX1=464&amp;cropX2=2998&amp;cropY1=209&amp;cropY2=2741" + alt=""></a></td> + <td class="rank">#53 </td> + <td class="name"><a href="/profile/alexis-sanchez/?list=athletes" class="exit_trigger_set">Alexis Sánchez</a></td> + <td>$30.8 M</td> + <td>$28.3 M</td> + <td>$2.5 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/clayton-kershaw/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe97fe4c687b00085939f4/200x200.jpg?background=000000&amp;cropX1=802&amp;cropX2=3201&amp;cropY1=95&amp;cropY2=2492" + alt=""></a></td> + <td class="rank">#54 </td> + <td class="name"><a href="/profile/clayton-kershaw/?list=athletes" class="exit_trigger_set">Clayton Kershaw</a> + </td> + <td>$30.7 M</td> + <td>$30 M</td> + <td>$700 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/kylian-mbappe/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe85694c687b0008593562/200x200.jpg?background=000000&amp;cropX1=19&amp;cropX2=1756&amp;cropY1=210&amp;cropY2=1948" + alt=""></a></td> + <td class="rank">#55 </td> + <td class="name"><a href="/profile/kylian-mbappe/?list=athletes" class="exit_trigger_set">Kylian Mbappe</a></td> + <td>$30.6 M</td> + <td>$26.6 M</td> + <td>$4 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/deontay-wilder/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe65cc4c687b0008592e49/200x200.jpg?background=000000&amp;cropX1=0&amp;cropX2=3648&amp;cropY1=500&amp;cropY2=4151" + alt=""></a></td> + <td class="rank">#56 </td> + <td class="name"><a href="/profile/deontay-wilder/?list=athletes" class="exit_trigger_set">Deontay Wilder</a></td> + <td>$30.5 M</td> + <td>$30 M</td> + <td>$500 K</td> + <td>Boxing</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/trey-flowers/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe5e8734a5c4000847ed45/200x200.jpg?background=000000&amp;cropX1=505&amp;cropX2=1554&amp;cropY1=47&amp;cropY2=1097" + alt=""></a></td> + <td class="rank">#57 </td> + <td class="name"><a href="/profile/trey-flowers/?list=athletes" class="exit_trigger_set">Trey Flowers</a></td> + <td>$30.2 M</td> + <td>$30 M</td> + <td>$250 K</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/mesut-ozil/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea9ff34a5c4000847fc79/200x200.jpg?background=000000&amp;cropX1=65&amp;cropX2=951&amp;cropY1=456&amp;cropY2=1342" + alt=""></a></td> + <td class="rank">#57 </td> + <td class="name"><a href="/profile/mesut-ozil/?list=athletes" class="exit_trigger_set">Mesut Ozil</a></td> + <td>$30.2 M</td> + <td>$23.7 M</td> + <td>$6.5 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/paul-millsap/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe85f734a5c4000847f61a/200x200.jpg?background=000000&amp;cropX1=320&amp;cropX2=2053&amp;cropY1=160&amp;cropY2=1895" + alt=""></a></td> + <td class="rank">#59 </td> + <td class="name"><a href="/profile/paul-millsap/?list=athletes" class="exit_trigger_set">Paul Millsap</a></td> + <td>$30.1 M</td> + <td>$29.6 M</td> + <td>$500 K</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/matt-ryan/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe864d142c50000a32811a/200x200.jpg?background=000000&amp;cropX1=99&amp;cropX2=2019&amp;cropY1=21&amp;cropY2=1941" + alt=""></a></td> + <td class="rank">#60 </td> + <td class="name"><a href="/profile/matt-ryan/?list=athletes" class="exit_trigger_set">Matt Ryan</a></td> + <td>$29.8 M</td> + <td>$24.8 M</td> + <td>$5 M</td> + <td>Football</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_6"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/justin-verlander/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea4944c687b0008593bbf/200x200.jpg?background=000000&amp;cropX1=1026&amp;cropX2=2694&amp;cropY1=561&amp;cropY2=2230" + alt=""></a></td> + <td class="rank">#61 </td> + <td class="name"><a href="/profile/justin-verlander/?list=athletes" class="exit_trigger_set">Justin Verlander</a> + </td> + <td>$29.5 M</td> + <td>$28.5 M</td> + <td>$1 M</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/yoenis-cespedes/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe86d64c687b0008593583/200x200.jpg?background=000000&amp;cropX1=353&amp;cropX2=1898&amp;cropY1=10&amp;cropY2=1554" + alt=""></a></td> + <td class="rank">#62 </td> + <td class="name"><a href="/profile/yoenis-cespedes/?list=athletes" class="exit_trigger_set">Yoenis Cespedes</a> + </td> + <td>$29.4 M</td> + <td>$29 M</td> + <td>$400 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/miguel-cabrera/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeaa6334a5c4000847fca0/200x200.jpg?background=000000&amp;cropX1=2070&amp;cropX2=3753&amp;cropY1=42&amp;cropY2=1724" + alt=""></a></td> + <td class="rank">#63 </td> + <td class="name"><a href="/profile/miguel-cabrera/?list=athletes" class="exit_trigger_set">Miguel Cabrera</a></td> + <td>$29.2 M</td> + <td>$28.7 M</td> + <td>$500 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/serena-williams/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe604034a5c4000847ee03/200x200.jpg?background=000000&amp;cropX1=1997&amp;cropX2=5400&amp;cropY1=600&amp;cropY2=4000" + alt=""></a></td> + <td class="rank">#63 </td> + <td class="name"><a href="/profile/serena-williams/?list=athletes" class="exit_trigger_set">Serena Williams</a> + </td> + <td>$29.2 M</td> + <td>$4.2 M</td> + <td>$25 M</td> + <td>Tennis</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/geno-atkins/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe9fce4c687b0008593aef/200x200.jpg?background=000000&amp;cropX1=0&amp;cropX2=2924&amp;cropY1=608&amp;cropY2=3534" + alt=""></a></td> + <td class="rank">#65 </td> + <td class="name"><a href="/profile/geno-atkins/?list=athletes" class="exit_trigger_set">Geno Atkins</a></td> + <td>$29.1 M</td> + <td>$29 M</td> + <td>$75 K</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/oscar/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe871b142c50000a328135/200x200.jpg?background=000000&amp;cropX1=911&amp;cropX2=4110&amp;cropY1=259&amp;cropY2=3456" + alt=""></a></td> + <td class="rank">#66 </td> + <td class="name"><a href="/profile/oscar/?list=athletes" class="exit_trigger_set">Oscar</a></td> + <td>$29 M</td> + <td>$27 M</td> + <td>$2 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/earl-thomas/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe87a4142c50000a3281d2/200x200.jpg?background=000000&amp;cropX1=1024&amp;cropX2=4550&amp;cropY1=125&amp;cropY2=3648" + alt=""></a></td> + <td class="rank">#66 </td> + <td class="name"><a href="/profile/earl-thomas/?list=athletes" class="exit_trigger_set">Earl Thomas</a></td> + <td>$29 M</td> + <td>$28.5 M</td> + <td>$500 K</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/jake-arrieta/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe88134c687b00085935a7/200x200.jpg?background=000000&amp;cropX1=1860&amp;cropX2=3894&amp;cropY1=84&amp;cropY2=2116" + alt=""></a></td> + <td class="rank">#68 </td> + <td class="name"><a href="/profile/jake-arrieta/?list=athletes" class="exit_trigger_set">Jake Arrieta</a></td> + <td>$28.8 M</td> + <td>$28.3 M</td> + <td>$500 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/cj-mccollum/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe88fb34a5c4000847f714/200x200.jpg?background=000000&amp;cropX1=811&amp;cropX2=2941&amp;cropY1=247&amp;cropY2=2379" + alt=""></a></td> + <td class="rank">#68 </td> + <td class="name"><a href="/profile/cj-mccollum/?list=athletes" class="exit_trigger_set">C.J. McCollum</a></td> + <td>$28.8 M</td> + <td>$25.8 M</td> + <td>$3 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/kawhi-leonard/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8aa234a5c4000847f74f/200x200.jpg?background=000000&amp;cropX1=0&amp;cropX2=2370&amp;cropY1=102&amp;cropY2=2474" + alt=""></a></td> + <td class="rank">#70 </td> + <td class="name"><a href="/profile/kawhi-leonard/?list=athletes" class="exit_trigger_set">Kawhi Leonard</a></td> + <td>$28.7 M</td> + <td>$23.2 M</td> + <td>$5.5 M</td> + <td>Basketball</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_7"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/kevin-love/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea5ec142c50000a3287f8/200x200.jpg?background=000000&amp;cropX1=43&amp;cropX2=1820&amp;cropY1=883&amp;cropY2=2662" + alt=""></a></td> + <td class="rank">#71 </td> + <td class="name"><a href="/profile/kevin-love/?list=athletes" class="exit_trigger_set">Kevin Love</a></td> + <td>$28.4 M</td> + <td>$24.4 M</td> + <td>$4 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/justin-houston/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea35f4c687b0008593b7a/200x200.jpg?background=000000&amp;cropX1=104&amp;cropX2=1435&amp;cropY1=211&amp;cropY2=1542" + alt=""></a></td> + <td class="rank">#72 </td> + <td class="name"><a href="/profile/justin-houston/?list=athletes" class="exit_trigger_set">Justin Houston</a></td> + <td>$28.2 M</td> + <td>$28 M</td> + <td>$200 K</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/albert-pujols/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe62a534a5c4000847ee97/200x200.jpg?background=000000&amp;cropX1=655&amp;cropX2=3317&amp;cropY1=162&amp;cropY2=2823" + alt=""></a></td> + <td class="rank">#73 </td> + <td class="name"><a href="/profile/albert-pujols/?list=athletes" class="exit_trigger_set">Albert Pujols</a></td> + <td>$28 M</td> + <td>$27.3 M</td> + <td>$700 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/dwight-howard/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe9e574c687b0008593aac/200x200.jpg?background=000000&amp;cropX1=852&amp;cropX2=4310&amp;cropY1=0&amp;cropY2=3456" + alt=""></a></td> + <td class="rank">#74 </td> + <td class="name"><a href="/profile/dwight-howard/?list=athletes" class="exit_trigger_set">Dwight Howard</a></td> + <td>$27.8 M</td> + <td>$24.3 M</td> + <td>$3.5 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/antoine-griezmann/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe677434a5c4000847f01a/200x200.jpg?background=000000&amp;cropX1=897&amp;cropX2=3006&amp;cropY1=74&amp;cropY2=2181" + alt=""></a></td> + <td class="rank">#75 </td> + <td class="name"><a href="/profile/antoine-griezmann/?list=athletes" class="exit_trigger_set">Antoine + Griezmann</a></td> + <td>$27.7 M</td> + <td>$23.2 M</td> + <td>$4.5 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/jrue-holiday/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8b4d4c687b000859361d/200x200.jpg?background=000000&amp;cropX1=490&amp;cropX2=2663&amp;cropY1=19&amp;cropY2=2191" + alt=""></a></td> + <td class="rank">#76 </td> + <td class="name"><a href="/profile/jrue-holiday/?list=athletes" class="exit_trigger_set">Jrue Holiday</a></td> + <td>$27.6 M</td> + <td>$27.1 M</td> + <td>$500 K</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/giancarlo-stanton/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8b90142c50000a32824f/200x200.jpg?background=000000&amp;cropX1=45&amp;cropX2=1420&amp;cropY1=273&amp;cropY2=1648" + alt=""></a></td> + <td class="rank">#77 </td> + <td class="name"><a href="/profile/giancarlo-stanton/?list=athletes" class="exit_trigger_set">Giancarlo + Stanton</a></td> + <td>$27.4 M</td> + <td>$25.4 M</td> + <td>$2 M</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/steven-adams/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8c0e34a5c4000847f780/200x200.jpg?background=000000&amp;cropX1=1616&amp;cropX2=3527&amp;cropY1=214&amp;cropY2=2127" + alt=""></a></td> + <td class="rank">#78 </td> + <td class="name"><a href="/profile/steven-adams/?list=athletes" class="exit_trigger_set">Steven Adams</a></td> + <td>$27.2 M</td> + <td>$24.2 M</td> + <td>$3 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/gareth-bale/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe9f4b34a5c4000847fb01/200x200.jpg?background=000000&amp;cropX1=1137&amp;cropX2=2502&amp;cropY1=289&amp;cropY2=1653" + alt=""></a></td> + <td class="rank">#79 </td> + <td class="name"><a href="/profile/gareth-bale/?list=athletes" class="exit_trigger_set">Gareth Bale</a></td> + <td>$27.1 M</td> + <td>$20.6 M</td> + <td>$6.5 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/bradley-beal/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe68aa142c50000a327ad8/200x200.jpg?background=000000&amp;cropX1=1861&amp;cropX2=6063&amp;cropY1=101&amp;cropY2=4300" + alt=""></a></td> + <td class="rank">#79 </td> + <td class="name"><a href="/profile/bradley-beal/?list=athletes" class="exit_trigger_set">Bradley Beal</a></td> + <td>$27.1 M</td> + <td>$25.6 M</td> + <td>$1.5 M</td> + <td>Basketball</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_8"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/tom-brady/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeb1c04c687b0008593e18/200x200.jpg?background=000000&amp;cropX1=531&amp;cropX2=2203&amp;cropY1=250&amp;cropY2=1923" + alt=""></a></td> + <td class="rank">#81 </td> + <td class="name"><a href="/profile/tom-brady/?list=athletes" class="exit_trigger_set">Tom Brady</a></td> + <td>$27 M</td> + <td>$15 M</td> + <td>$12 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/andrew-luck/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe64ab142c50000a32799c/200x200.jpg?background=000000&amp;cropX1=863&amp;cropX2=2673&amp;cropY1=79&amp;cropY2=1891" + alt=""></a></td> + <td class="rank">#82 </td> + <td class="name"><a href="/profile/andrew-luck/?list=athletes" class="exit_trigger_set">Andrew Luck</a></td> + <td>$26.9 M</td> + <td>$24.1 M</td> + <td>$2.8 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/cj-mosley/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8ca6142c50000a3282ac/200x200.jpg?background=000000&amp;cropX1=514&amp;cropX2=1845&amp;cropY1=478&amp;cropY2=1810" + alt=""></a></td> + <td class="rank">#82 </td> + <td class="name"><a href="/profile/cj-mosley/?list=athletes" class="exit_trigger_set">C.J. Mosley</a></td> + <td>$26.9 M</td> + <td>$26.7 M</td> + <td>$150 K</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/felix-hernandez/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe9ec54c687b0008593ad3/200x200.jpg?background=000000&amp;cropX1=941&amp;cropX2=2348&amp;cropY1=85&amp;cropY2=1493" + alt=""></a></td> + <td class="rank">#84 </td> + <td class="name"><a href="/profile/felix-hernandez/?list=athletes" class="exit_trigger_set">Felix Hernandez</a> + </td> + <td>$26.6 M</td> + <td>$26.3 M</td> + <td>$300 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/odell-beckham-jr/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8d28142c50000a3282c2/200x200.jpg?background=000000&amp;cropX1=236&amp;cropX2=2437&amp;cropY1=240&amp;cropY2=2442" + alt=""></a></td> + <td class="rank">#85 </td> + <td class="name"><a href="/profile/odell-beckham-jr/?list=athletes" class="exit_trigger_set">Odell Beckham, + Jr.</a></td> + <td>$26.5 M</td> + <td>$21.5 M</td> + <td>$5 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/otto-porter-jr/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8db64c687b00085936fd/200x200.jpg?background=000000&amp;cropX1=326&amp;cropX2=1821&amp;cropY1=148&amp;cropY2=1643" + alt=""></a></td> + <td class="rank">#85 </td> + <td class="name"><a href="/profile/otto-porter-jr/?list=athletes" class="exit_trigger_set">Otto Porter, Jr.</a> + </td> + <td>$26.5 M</td> + <td>$26 M</td> + <td>$500 K</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/andre-drummond/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe632c34a5c4000847eeb8/200x200.jpg?background=000000&amp;cropX1=1057&amp;cropX2=2710&amp;cropY1=461&amp;cropY2=2115" + alt=""></a></td> + <td class="rank">#87 </td> + <td class="name"><a href="/profile/andre-drummond/?list=athletes" class="exit_trigger_set">Andre Drummond</a></td> + <td>$26.4 M</td> + <td>$25.4 M</td> + <td>$1 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/harrison-barnes/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8e3c4c687b0008593780/200x200.jpg?background=000000&amp;cropX1=698&amp;cropX2=3328&amp;cropY1=0&amp;cropY2=2628" + alt=""></a></td> + <td class="rank">#88 </td> + <td class="name"><a href="/profile/harrison-barnes/?list=athletes" class="exit_trigger_set">Harrison Barnes</a> + </td> + <td>$26.3 M</td> + <td>$24.8 M</td> + <td>$1.5 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/nikola-jokic/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8ecb34a5c4000847f830/200x200.jpg?background=000000&amp;cropX1=647&amp;cropX2=3196&amp;cropY1=5&amp;cropY2=2557" + alt=""></a></td> + <td class="rank">#89 </td> + <td class="name"><a href="/profile/nikola-jokic/?list=athletes" class="exit_trigger_set">Nikola Jokic</a></td> + <td>$26.2 M</td> + <td>$25.5 M</td> + <td>$750 K</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/hassan-whiteside/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe8f45142c50000a3283bb/200x200.jpg?background=000000&amp;cropX1=836&amp;cropX2=1800&amp;cropY1=60&amp;cropY2=1025" + alt=""></a></td> + <td class="rank">#89 </td> + <td class="name"><a href="/profile/hassan-whiteside/?list=athletes" class="exit_trigger_set">Hassan Whiteside</a> + </td> + <td>$26.2 M</td> + <td>$25.4 M</td> + <td>$750 K</td> + <td>Basketball</td> + </tr> + <tr class="ad"> + <td class="ad lazy_ad" colspan="7" id="topx_9"></td> + </tr> + <tr class="data"> + <td class="image"><a href="/profile/andrew-wiggins/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe65364c687b0008592e21/200x200.jpg?background=000000&amp;cropX1=143&amp;cropX2=2533&amp;cropY1=0&amp;cropY2=2388" + alt=""></a></td> + <td class="rank">#91 </td> + <td class="name"><a href="/profile/andrew-wiggins/?list=athletes" class="exit_trigger_set">Andrew Wiggins</a></td> + <td>$26.1 M</td> + <td>$25.5 M</td> + <td>$600 K</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/manny-pacquiao/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea91f142c50000a3288e7/200x200.jpg?background=000000&amp;cropX1=788&amp;cropX2=3590&amp;cropY1=305&amp;cropY2=3105" + alt=""></a></td> + <td class="rank">#92 </td> + <td class="name"><a href="/profile/manny-pacquiao/?list=athletes" class="exit_trigger_set">Manny Pacquiao</a></td> + <td>$26 M</td> + <td>$24 M</td> + <td>$2 M</td> + <td>Boxing</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/saquon-barkley/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe94064c687b000859392f/200x200.jpg?background=000000&amp;cropX1=1259&amp;cropX2=4511&amp;cropY1=398&amp;cropY2=3648" + alt=""></a></td> + <td class="rank">#93 </td> + <td class="name"><a href="/profile/saquon-barkley/?list=athletes" class="exit_trigger_set">Saquon Barkley</a></td> + <td>$25.8 M</td> + <td>$21.3 M</td> + <td>$4.5 M</td> + <td>Football</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/jd-martinez/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe948e142c50000a32852e/200x200.jpg?background=000000&amp;cropX1=144&amp;cropX2=1906&amp;cropY1=609&amp;cropY2=2373" + alt=""></a></td> + <td class="rank">#94 </td> + <td class="name"><a href="/profile/jd-martinez/?list=athletes" class="exit_trigger_set">J.D. Martinez</a></td> + <td>$25.6 M</td> + <td>$24.9 M</td> + <td>$700 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/gennady-golovkin/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe952d142c50000a328560/200x200.jpg?background=000000&amp;cropX1=525&amp;cropX2=2859&amp;cropY1=781&amp;cropY2=3116" + alt=""></a></td> + <td class="rank">#95 </td> + <td class="name"><a href="/profile/gennady-golovkin/?list=athletes" class="exit_trigger_set">Gennady Golovkin</a> + </td> + <td>$25.5 M</td> + <td>$23 M</td> + <td>$2.5 M</td> + <td>Boxing</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/joey-votto/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe9599142c50000a328592/200x200.jpg?background=000000&amp;cropX1=634&amp;cropX2=1975&amp;cropY1=418&amp;cropY2=1760" + alt=""></a></td> + <td class="rank">#96 </td> + <td class="name"><a href="/profile/joey-votto/?list=athletes" class="exit_trigger_set">Joey Votto</a></td> + <td>$25.4 M</td> + <td>$25.1 M</td> + <td>$300 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/jon-lester/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfea20d4c687b0008593b2b/200x200.jpg?background=000000&amp;cropX1=1720&amp;cropX2=3557&amp;cropY1=1289&amp;cropY2=3125" + alt=""></a></td> + <td class="rank">#97 </td> + <td class="name"><a href="/profile/jon-lester/?list=athletes" class="exit_trigger_set">Jon Lester</a></td> + <td>$25.3 M</td> + <td>$25 M</td> + <td>$300 K</td> + <td>Baseball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/marc-gasol/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe968e34a5c4000847f94f/200x200.jpg?background=000000&amp;cropX1=760&amp;cropX2=2309&amp;cropY1=190&amp;cropY2=1740" + alt=""></a></td> + <td class="rank">#98 </td> + <td class="name"><a href="/profile/marc-gasol/?list=athletes" class="exit_trigger_set">Marc Gasol</a></td> + <td>$25.1 M</td> + <td>$24.1 M</td> + <td>$1 M</td> + <td>Basketball</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/mohamed-salah/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfe5f6c142c50000a3277b7/200x200.jpg?background=000000&amp;cropX1=90&amp;cropX2=1841&amp;cropY1=90&amp;cropY2=1842" + alt=""></a></td> + <td class="rank">#98 </td> + <td class="name"><a href="/profile/mohamed-salah/?list=athletes" class="exit_trigger_set">Mohamed Salah</a></td> + <td>$25.1 M</td> + <td>$16.1 M</td> + <td>$9 M</td> + <td>Soccer</td> + </tr> + + <tr class="data"> + <td class="image"><a href="/profile/virat-kohli/?list=athletes" class="exit_trigger_set"><img + src="//specials-images.forbesimg.com/imageserve/5cfeb29d4c687b0008593e53/200x200.jpg?background=000000&amp;cropX1=751&amp;cropX2=3319&amp;cropY1=46&amp;cropY2=2616" + alt=""></a></td> + <td class="rank">#100 </td> + <td class="name"><a href="/profile/virat-kohli/?list=athletes" class="exit_trigger_set">Virat Kohli</a></td> + <td>$25 M</td> + <td>$4 M</td> + <td>$21 M</td> + <td>Cricket</td> + </tr> + </tbody> +</table> +\ No newline at end of file diff --git a/table2json.js b/table2json.js @@ -0,0 +1,34 @@ +class table2json { + constructor(tableID) { + this.table = document.getElementById(tableID); + if (!this.table) { + this.error = true; + console.error(`Table of id "${tableID}" not found.`); + return; + } + if (this.table.tagName != "TABLE") { + this.error = true; + console.error(`Element of id "${tableID}" is not a table.`); + return; + } + this.headers = []; + for (let i = 0; i < this.table.rows[0].cells.length; i++) + this.headers.push(this.table.rows[0].cells[i].innerText); + if (this.headers.length > new Set(this.headers).size) { + this.error = true; + console.error(`Headers repeat.`); + return; + } + this.res = []; + for (let i = 1; i < this.table.rows.length; i++) { + let values = []; + for (let j = 0; j < this.table.rows[i].cells.length; j++) + values.push(this.table.rows[i].cells[j].innerText); + let obj = {}; + this.headers.forEach( + (el, index) => (obj = { ...obj, [el.valueOf()]: values[index] }) + ); + this.res.push(obj); + } + } +}