Skip to content

Commit

Permalink
Fix Rechtspraak.nl (zotero#3220)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam3smith authored Jan 9, 2024
1 parent c73db0a commit 8e3f572
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Rechtspraak.nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2023-01-18 18:21:16"
"lastUpdated": "2024-01-09 03:25:57"
}

/*
Expand Down Expand Up @@ -75,13 +75,13 @@ function cleanTags(x) {
}

function detectWeb(doc, url) {
if (url.includes('/#!/details') || url.includes('/front/portal/document-viewer')) {
if (url.includes('.nl/details') || url.includes('/front/portal/document-viewer')) {
return "case";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
else if (url.includes('/#!/resultaat') && doc.querySelector('app-results')) {
else if (url.includes('/resultaat') && doc.querySelector('app-results')) {
Z.monitorDOMChanges(doc.querySelector('app-results'), { childList: true, subtree: true });
}
return false;
Expand All @@ -90,7 +90,7 @@ function detectWeb(doc, url) {
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.rnl-listresults-item-title > a[href*="#!/details"]');
var rows = doc.querySelectorAll('.rnl-listresults-item-title > a[href*="/details"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
Expand All @@ -117,8 +117,8 @@ async function doWeb(doc, url) {
}

async function scrape(url) {
let apiURL = url.includes('#!/details')
? url.replace('#!/details', 'api/document/')
let apiURL = url.includes('/details')
? url.replace('/details', '/api/document/')
: `https://uitspraken.rechtspraak.nl/api/document/?id=${url.match(/ext-id=([^&#]+)/)[1]}`;
let json = await requestJSON(apiURL);
let item = new Zotero.Item("case");
Expand Down Expand Up @@ -163,7 +163,7 @@ async function scrape(url) {
var testCases = [
{
"type": "web",
"url": "https://uitspraken.rechtspraak.nl/#!/details?id=ECLI:NL:GHDHA:2018:2591",
"url": "https://uitspraken.rechtspraak.nl/details?id=ECLI:NL:GHDHA:2018:2591",
"items": [
{
"itemType": "case",
Expand Down Expand Up @@ -194,7 +194,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://uitspraken.rechtspraak.nl/#!/details?id=ECLI:NL:PHR:2019:1016",
"url": "https://uitspraken.rechtspraak.nl/details?id=ECLI:NL:PHR:2019:1016",
"items": [
{
"itemType": "case",
Expand Down Expand Up @@ -225,7 +225,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://uitspraken.rechtspraak.nl/#!/details?id=ECLI:NL:ORBAACM:2020:30&showbutton=true",
"url": "https://uitspraken.rechtspraak.nl/details?id=ECLI:NL:ORBAACM:2020:30&showbutton=true",
"items": [
{
"itemType": "case",
Expand Down Expand Up @@ -258,7 +258,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://uitspraken.rechtspraak.nl/#!/resultaat?zoekterm=test&inhoudsindicatie=zt0&publicatiestatus=ps1&sort=Relevance",
"url": "https://uitspraken.rechtspraak.nl/resultaat?zoekterm=test&inhoudsindicatie=zt0&publicatiestatus=ps1&sort=Relevance",
"items": "multiple"
},
{
Expand Down

0 comments on commit 8e3f572

Please sign in to comment.