unprint 0.11.3 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/app.js +8 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {
package/src/app.js CHANGED
@@ -317,17 +317,11 @@ function prefixUrl(urlPath, originUrl, customOptions) {
317
317
  return null;
318
318
  }
319
319
 
320
- if (!originUrl) {
321
- return urlPath;
322
- }
323
-
324
320
  const options = {
325
321
  protocol: 'https',
326
322
  ...customOptions,
327
323
  };
328
324
 
329
- const { origin, protocol } = new URL(originUrl);
330
-
331
325
  if (/^http/.test(urlPath)) {
332
326
  // this is already a complete URL
333
327
  return urlPath;
@@ -337,6 +331,12 @@ function prefixUrl(urlPath, originUrl, customOptions) {
337
331
  return `${options.protocol.replace(/:$/, '')}:${urlPath}`; // allow protocol to be defined either as 'https' or 'https:'
338
332
  }
339
333
 
334
+ if (!originUrl) {
335
+ return urlPath;
336
+ }
337
+
338
+ const { origin, protocol } = new URL(originUrl);
339
+
340
340
  if (protocol && /^\/\//.test(urlPath)) {
341
341
  return `${protocol}${urlPath}`;
342
342
  }
@@ -530,7 +530,7 @@ function queryStyles(context, selector, customOptions) {
530
530
  return elStyles.filter(Boolean);
531
531
  }
532
532
 
533
- function queryVideo(context, selector = 'source', customOptions) {
533
+ function queryVideo(context, selector = 'video source', customOptions) {
534
534
  const options = {
535
535
  ...context.options,
536
536
  attribute: 'src',
@@ -543,7 +543,7 @@ function queryVideo(context, selector = 'source', customOptions) {
543
543
  return prefixUrl(videoUrl, options.origin, options);
544
544
  }
545
545
 
546
- function queryVideos(context, selector = 'source', customOptions) {
546
+ function queryVideos(context, selector = 'video source', customOptions) {
547
547
  const options = {
548
548
  ...context.options,
549
549
  attribute: 'src',