소스 검색

support cdn-converted webp media

Mike L 3 년 전
부모
커밋
59f6979d76
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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(