(html, parentUrl)
| 244 | |
| 245 | // countytr |
| 246 | function parseCountry(html, parentUrl) { |
| 247 | let $ = renderDom(html); |
| 248 | let result = []; |
| 249 | $("tr.countytr").each(function(index, element) { |
| 250 | let td0 = null, |
| 251 | td1 = null, |
| 252 | url = ""; |
| 253 | if ($(this).find("a").length == 0) { |
| 254 | td0 = $(this).find("td").first(); |
| 255 | td1 = $(this).find("td").last(); |
| 256 | } else { |
| 257 | td0 = $(this).find("a").first(); |
| 258 | td1 = $(this).find("a").last(); |
| 259 | } |
| 260 | let id = td0.text(); |
| 261 | let name = td1.text(); |
| 262 | if (td0.attr("href")) { |
| 263 | url = joinUrl(parentUrl, td0.attr("href")); |
| 264 | } |
| 265 | result.push({ |
| 266 | id: id, |
| 267 | name: name, |
| 268 | url: url |
| 269 | }); |
| 270 | }); |
| 271 | |
| 272 | |
| 273 | return result; |
| 274 | |
| 275 | } |
| 276 | |
| 277 | |
| 278 | // towntr |
no test coverage detected