Added Lets Doe It scraper. Added timestamp matching to qu's duration method.
This commit is contained in:
@@ -185,6 +185,16 @@ function duration(context, selector, match, attr = 'textContent') {
|
||||
return moment.duration(segments.join(':')).asSeconds();
|
||||
}
|
||||
|
||||
const timestampMatch = durationString.match(/T(\d+H)?(\d+M)?\d+S/);
|
||||
|
||||
if (timestampMatch) {
|
||||
const hours = timestampMatch[0].match(/(\d+)H/)?.[1] || 0;
|
||||
const minutes = timestampMatch[0].match(/(\d+)M/)?.[1] || 0;
|
||||
const seconds = timestampMatch[0].match(/(\d+)S/)?.[1] || 0;
|
||||
|
||||
return (Number(hours) * 3600) + (Number(minutes) * 60) + Number(seconds);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user