benibela / videlibri

:books: Cross-platform library client to automate any OPAC and library catalog from your local device, e.g. for renewing of borrowed books or searching for books available in the library in automated scripts.
https://www.videlibri.de/
GNU General Public License v3.0
36 stars 5 forks source link

duedate wrong for Stadtbibliothek Chemnitz #9

Closed tribut closed 2 months ago

tribut commented 1 year ago

When using xidel to query Stadtbibliothek Chemnitz as suggested in the README, the due date is wrong:

$ xidel -e '$username:="XXX",
          $password:="XXX",
          $server:="https://opac2.stadtbibliothek-chemnitz.de/webOPACClient/",
          $startparams:="?Login=opsb"
    ' --template-action connect,update-all  \
      --module mockvidelibri.xqm --xmlns videlibri=https://www.videlibri.de --dot-notation=on \
      --template-file data/libraries/templates/sisis/template \
      --output-format=json-wrapped \
      -s |
    jq -c 'last | .book[0] | [.title, .duedate]'
["Busy Bee","2023-04-25"]

This is how it looks on the web, the supposed due date is actually the date it was borrowed:

Screenshot 2023-07-08 at 14-05-41 webOPAC

The table cell does not contain any additional markup in HTML:

            <td>

             25.04.2023 - 21.07.2023<br>
             Zentralbibl.
            </td>

If you need any more information, please let me know.

benibela commented 1 year ago

I use a regular expression to get the dates ((\d{2}\.\d{2}\.\d{4}) *-)? *(\d{2}\.\d{2}\.\d{4}: https://github.com/benibela/videlibri/blob/master/data/libraries/templates/sisis/loggedIn#L121C44-L121C94

Perhaps that is not as greedy as I thought it would be. Try removing the ? from it

benibela commented 1 year ago

Oh, now I understand it

Just call Xidel wit the --deprecated-trim-nodes option

Alhough the regular expression does not match 25.04.2023 - 21.07.2023 correctly, it works correctly for 25.04.2023 - 21.07.2023.

tribut commented 1 year ago

Thanks, that did it!