TouchPoint: fix copies for Chemnitz
@@ -725,14 +725,23 @@ public class TouchPoint extends OkHttpBaseApi implements OpacApi {
}
// Copies
- String copiesParameter = doc.select("div[id^=ajax_holdings_url")
- .attr("ajaxParameter").replace("&amp;", "");
+ String copiesParameter = doc.select("div[id^=ajax_holdings_url]")
+ .attr("ajaxParameter");
+ if ("".equals(copiesParameter)) {
+ copiesParameter = doc.select("div[id^=ajax_holdings_url]")
+ .attr("data-ajaxParameter");
+ }
+ copiesParameter = copiesParameter.replace("&amp;", "");
if (!"".equals(copiesParameter)) {
String copiesHtml = httpGet(opac_url + "/" + copiesParameter,
ENCODING);
Document copiesDoc = Jsoup.parse(copiesHtml);
List<String> table_keys = new ArrayList<>();
- for (Element th : copiesDoc.select(".data tr th")) {
+
+ // newer versions (e.g. Chemnitz) use divs instead of tables
+ boolean table = copiesDoc.select(".data tr th").size() > 0;
+
+ for (Element th : copiesDoc.select(table ? ".data tr th" : ".data div.d-none > div")) {
if (th.text().contains("Zweigstelle")) {
table_keys.add("branch");
} else if (th.text().contains("Status")) {
@@ -743,10 +752,11 @@ public class TouchPoint extends OkHttpBaseApi implements OpacApi {
table_keys.add(null);
}
}
- for (Element tr : copiesDoc.select(".data tr:has(td)")) {
+ for (Element tr : copiesDoc
+ .select(table ? ".data tr:has(td)" : ".data .py-1:has(div)")) {
Copy copy = new Copy();
int i = 0;
- for (Element td : tr.select("td")) {
+ for (Element td : tr.select(table ? "td" : "> div")) {
if (table_keys.get(i) != null) {
copy.set(table_keys.get(i), td.text().trim());
}
