Browse Source

support cdn-converted webp media

Mike L 3 years ago
parent
commit
59f6979d76
2 changed files with 2 additions and 2 deletions
  1. 1 1
      dist/webshot.js
  2. 1 1
      src/webshot.ts

+ 1 - 1
dist/webshot.js

@@ -209,7 +209,7 @@ class Webshot extends CallableInstance {
             }
             logger.warn('unable to find MIME type of fetched media, failing this fetch');
             throw Error();
-        })(/\/.*\.(.+?)\?/.exec(url)[1]));
+        })(/\/.+\.(?:.*?(?<=[?&])stp=dst-(jpg)|(.+?)\?)/.exec(url).filter(g => g)[1]));
         if (this.mode = mode) {
             if (onready)
                 onready();

+ 1 - 1
src/webshot.ts

@@ -248,7 +248,7 @@ class Webshot extends CallableInstance<[LazyMediaItem[], (...args) => void, numb
       }
       logger.warn('unable to find MIME type of fetched media, failing this fetch');
       throw Error();
-    })(/\/.*\.(.+?)\?/.exec(url)[1])
+    })(/\/.+\.(?:.*?(?<=[?&])stp=dst-(jpg)|(.+?)\?)/.exec(url).filter(g => g)[1])
   );
 
   public webshot(