浏览代码

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');
             logger.warn('unable to find MIME type of fetched media, failing this fetch');
             throw Error();
             throw Error();
-        })(/\/.*\.(.+?)\?/.exec(url)[1]));
+        })(/\/.+\.(?:.*?(?<=[?&])stp=dst-(jpg)|(.+?)\?)/.exec(url).filter(g => g)[1]));
         onready();
         onready();
     }
     }
     webshot(mediaItems, callback, webshotDelay) {
     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');
       logger.warn('unable to find MIME type of fetched media, failing this fetch');
       throw Error();
       throw Error();
-    })(/\/.*\.(.+?)\?/.exec(url)[1])
+    })(/\/.+\.(?:.*?(?<=[?&])stp=dst-(jpg)|(.+?)\?)/.exec(url).filter(g => g)[1])
   );
   );
 
 
   public webshot(
   public webshot(