pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add hls downloader

Pas 5feda3ed 39948661

+23 -5
+23 -5
src/components/player/atoms/settings/Downloads.tsx
··· 44 44 const router = useOverlayRouter(id); 45 45 const { t } = useTranslation(); 46 46 const downloadUrl = useDownloadLink(); 47 + 48 + // Custom function to process the download URL 49 + const processDownloadUrl = useCallback(() => { 50 + if (!downloadUrl) return ""; 51 + 52 + // Check if the URL contains the m3u8-proxy and the ?url= parameter 53 + const match = downloadUrl.match(/m3u8-proxy\?url=(.*)$/); 54 + if (match && match[1]) { 55 + // Decode the URL component 56 + return decodeURIComponent(match[1]); 57 + } 58 + 59 + return downloadUrl; // Return original if no specific pattern is found 60 + }, [downloadUrl]); 61 + 62 + const hlsDownload = `https://hls-downloader.pstream.org/?url=${encodeURIComponent(processDownloadUrl())}`; 47 63 const [, copyToClipboard] = useCopyToClipboard(); 48 64 49 65 const sourceType = usePlayerStore((s) => s.source?.type); ··· 66 82 <Menu.Section> 67 83 <div> 68 84 {sourceType === "hls" ? ( 69 - <> 85 + <div className="mb-6"> 70 86 <Menu.Paragraph marginClass="mb-6"> 71 87 <StyleTrans k="player.menus.downloads.hlsDisclaimer" /> 72 88 </Menu.Paragraph> 73 - 89 + <Button className="w-full mt-2" theme="purple" href={hlsDownload}> 90 + Atempt download 91 + </Button> 74 92 <Button 75 - className="w-full" 76 - theme="purple" 93 + className="w-full mt-2" 94 + theme="secondary" 77 95 href={downloadUrl} 78 96 onClick={(event) => { 79 97 // Allow context menu & left click to copy ··· 92 110 > 93 111 {t("player.menus.downloads.downloadSubtitle")} 94 112 </Button> 95 - </> 113 + </div> 96 114 ) : ( 97 115 <> 98 116 <Menu.ChevronLink onClick={() => router.navigate("/download/pc")}>