(html, parentUrl)
| 277 | |
| 278 | // towntr |
| 279 | function parseTown(html, parentUrl) { |
| 280 | let $ = renderDom(html); |
| 281 | let result = []; |
| 282 | $("tr.towntr").each(function(index, element) { |
| 283 | let td0 = null, |
| 284 | td1 = null, |
| 285 | url = ""; |
| 286 | if ($(this).find("a").length == 0) { |
| 287 | td0 = $(this).find("td").first(); |
| 288 | td1 = $(this).find("td").last(); |
| 289 | } else { |
| 290 | td0 = $(this).find("a").first(); |
| 291 | td1 = $(this).find("a").last(); |
| 292 | } |
| 293 | let id = td0.text(); |
| 294 | let name = td1.text(); |
| 295 | if (td0.attr("href")) { |
| 296 | url = joinUrl(parentUrl, td0.attr("href")); |
| 297 | } |
| 298 | result.push({ |
| 299 | id: id, |
| 300 | name: name, |
| 301 | url: url |
| 302 | }); |
| 303 | }); |
| 304 | |
| 305 | |
| 306 | return result; |
| 307 | } |
| 308 | |
| 309 | // villagetr |
| 310 | function parseVillage(html) { |
no test coverage detected