commit 95e510d260b78168ac2d6321f947db43cc2b1213
parent 47e92cea0e1979c7185765f887f3922ee29eb6f1
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Wed, 8 May 2024 12:03:48 +0200
tracks: fix regexp for extracting tracks from Wikiloc page
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/lib/leaflet.control.track-list/lib/services/wikiloc.js b/src/lib/leaflet.control.track-list/lib/services/wikiloc.js
@@ -5,7 +5,7 @@ import twkb from 'twkb';
class Wikiloc extends BaseService {
urlRe = /^https?:\/\/(?:.+\.)?wikiloc\.com\/.*-(\d+)/u;
- mapDataRe = /mapData=(.*);/u;
+ mapDataRe = /mapData\s*=\s*(.+);/u;
getTrackId() {
const m = this.urlRe.exec(this.origUrl);
@@ -29,11 +29,10 @@ class Wikiloc extends BaseService {
const trackId = this.getTrackId();
const name = `Wikiloc track ${trackId}`;
const response = responses[0];
- const m = this.mapDataRe.exec(response.responseText);
if (response.status === 404) {
return [{error: 'Wikiloc trail does not exist'}];
}
-
+ const m = this.mapDataRe.exec(response.responseText);
try {
const data = JSON.parse(m[1]);