Преглед изворни кода

support cdn-converted webp media

Mike L пре 3 година
родитељ
комит
06447f96e1
2 измењених фајлова са 2 додато и 2 уклоњено
  1. 1 1
      dist/webshot.js
  2. 1 1
      src/webshot.ts

+ 1 - 1
dist/webshot.js

@@ -56,7 +56,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]));
         onready();
     }
     webshot(mediaItems, callback, webshotDelay) {

+ 1 - 1
src/webshot.ts

@@ -62,7 +62,7 @@ class Webshot extends CallableInstance<[MediaItem[], (...args) => void, number],
       }
       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(