| 25871 | const audioExtensions = new Set(['flac', 'm4a', 'mp3', 'oga', 'ogg', 'opus', 'wav']); |
| 25872 | |
| 25873 | function isVideoLink(url) { |
| 25874 | if (url.indexOf('.video') !== -1 || url.indexOf('video:') === 0) |
| 25875 | return true; |
| 25876 | |
| 25877 | url = url.replace(/.gif(\?width=\d*&|\?)format=mp4/, '.mp4?').replace(/\/$/, ""); |
| 25878 | if (url.lastIndexOf('?') > 0) |
| 25879 | url = url.substring(0, url.lastIndexOf('?')); |
| 25880 | const ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase(); |
| 25881 | |
| 25882 | return videoExtensions.has(ext) |
| 25883 | || url.indexOf('googlevideo.com/videoplayback') > 0 |
| 25884 | || url.indexOf('v.redd.it') > 0; |
| 25885 | } |
| 25886 | |
| 25887 | function isAudioLink(url) { |
| 25888 | if (url.indexOf('.audio') !== -1 || url.indexOf('audio:') === 0) |