I would like to ask how one would get information from an HTML page that does not necessary provide RSS or JSON/XLM API.
When I see the source code of the page (that will be used as source of my data), I see something like this in the code:
<tr class="even" data-people_id="80704">
<td class="shirtnumber">26</td>
<td class="photo"><a href="/players/alper-potuk/80704/" ><img src="http://ift.tt/1TVCNuK" style="width:18px; height:18px;"></a></td>
<td class="name large-link"><a href="/players/alper-potuk/80704/" >A. Potuk</a></td>
<td class="flag"><span class="flag_16 right_16 turkey_16_right"> </span></td>
<td class="number age">24</td>
<td class="position large-link"><span title="Midfielder">M</span></td>
<td class="number statistic game-minutes available">2000</td>
<td class="number statistic appearances available">30</td>
<td class="number statistic lineups available">21</td>
<td class="number statistic subs-in available">9</td>
<td class="number statistic subs-out available">8</td>
<td class="number statistic subs-on-bench available">10</td>
<td class="number statistic goals available">3</td>
<td class="number statistic yellow-cards available">4</td>
<td class="number statistic 2nd-yellow-cards available">0</td>
<td class="number statistic red-cards available">0</td>
</tr>
<tr class="odd" data-people_id="5082">
<td class="shirtnumber">38</td>
<td class="photo"><a href="/players/mehmet-topuz/5082/" ><img src="http://ift.tt/1TVCOPv" style="width:18px; height:18px;"></a></td>
<td class="name large-link"><a href="/players/mehmet-topuz/5082/" >M. Topuz</a></td>
<td class="flag"><span class="flag_16 right_16 turkey_16_right"> </span></td>
<td class="number age">31</td>
<td class="position large-link"><span title="Midfielder">M</span></td>
<td class="number statistic game-minutes available">324</td>
<td class="number statistic appearances available">8</td>
<td class="number statistic lineups available">3</td>
<td class="number statistic subs-in available">5</td>
<td class="number statistic subs-out available">0</td>
<td class="number statistic subs-on-bench available">16</td>
<td class="number statistic goals available">1</td>
<td class="number statistic yellow-cards available">0</td>
<td class="number statistic 2nd-yellow-cards available">0</td>
<td class="number statistic red-cards available">1</td>
</tr>
<tr class="even" data-people_id="6408">
<td class="shirtnumber">88</td>
<td class="photo"><a href="/players/caner-erkin/6408/" ><img src="http://ift.tt/1dpsMof" style="width:18px; height:18px;"></a></td>
<td class="name large-link"><a href="/players/caner-erkin/6408/" >C. Erkin</a></td>
<td class="flag"><span class="flag_16 right_16 turkey_16_right"> </span></td>
<td class="number age">26</td>
<td class="position large-link"><span title="Midfielder">M</span></td>
<td class="number statistic game-minutes available">2616</td>
<td class="number statistic appearances available">31</td>
<td class="number statistic lineups available">30</td>
<td class="number statistic subs-in available">1</td>
<td class="number statistic subs-out available">4</td>
<td class="number statistic subs-on-bench available">1</td>
<td class="number statistic goals available">3</td>
<td class="number statistic yellow-cards available">12</td>
<td class="number statistic 2nd-yellow-cards available">1</td>
<td class="number statistic red-cards available">1</td>
</tr>
<tr class="odd" data-people_id="307074">
<td class="shirtnumber"> </td>
<td class="photo"><a href="/players/ramazan-civelek/307074/" ><img src="http://ift.tt/1TVCOPx" style="width:18px; height:18px;"></a></td>
<td class="name large-link"><a href="/players/ramazan-civelek/307074/" >R. Civelek</a></td>
<td class="flag"><span class="flag_16 right_16 turkey_16_right"> </span></td>
<td class="number age">19</td>
<td class="position large-link"><span title="Midfielder">M</span></td>
<td class="number statistic game-minutes ">0</td>
<td class="number statistic appearances ">0</td>
<td class="number statistic lineups ">0</td>
<td class="number statistic subs-in ">0</td>
<td class="number statistic subs-out ">0</td>
<td class="number statistic subs-on-bench ">0</td>
<td class="number statistic goals ">0</td>
<td class="number statistic yellow-cards ">0</td>
<td class="number statistic 2nd-yellow-cards ">0</td>
<td class="number statistic red-cards ">0</td>
</tr>
I would like to have these data retrieved using an ajax call and then displayed on tables. The problem is though I haven't managed to get this working without using PHP, WebService or any server side API. I want to get it done using jQuery but I am confused. Someone suggested that I can't because of Crossdomain issue. Another one said I need to use YQL (I went through it but it's too complicated) .
I am looking for the simplest solution possible to get the players squad list and number of matches they have played using JSON and display it on my html page table.
If I understand correctly, I have to target the html class, odd and even in this case? So I can have the following HTML output:
`Player Name - Shirt No - Games Played - Position
A. Potuk 26 24 Midfielder M. Topuz 38 31 Midfielder
P.S Code snippets are greatly appreciated !
Aucun commentaire:
Enregistrer un commentaire