Merge pull request #1111 from Stremio/fix/copy-download-and-copy-streaming-urls

fix(streams): copy stream link returns streamable url
This commit is contained in:
Timothy Z. 2026-01-22 12:32:51 +02:00 committed by GitHub
commit 4ce5ef3744
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -86,6 +86,10 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio
}, [href, deepLinks]);
const streamLink = React.useMemo(() => {
return deepLinks?.externalPlayer?.streaming;
}, [deepLinks]);
const downloadLink = React.useMemo(() => {
return deepLinks?.externalPlayer?.download;
}, [deepLinks]);
@ -116,6 +120,28 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio
}
}, [props.onClick, profile.settings, markVideoAsWatched]);
const copyDownloadLink = React.useCallback((event) => {
event.preventDefault();
closeMenu();
if (downloadLink) {
navigator.clipboard.writeText(downloadLink)
.then(() => {
toast.show({
type: 'success',
title: t('PLAYER_COPY_DOWNLOAD_LINK_SUCCESS'),
timeout: 4000
});
})
.catch(() => {
toast.show({
type: 'error',
title: t('PLAYER_COPY_DOWNLOAD_LINK_ERROR'),
timeout: 4000,
});
});
}
}, [downloadLink]);
const copyStreamLink = React.useCallback((event) => {
event.preventDefault();
closeMenu();
@ -195,6 +221,13 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio
<div className={styles['context-menu-option-label']}>{t('CTX_COPY_STREAM_LINK')}</div>
</Button>
}
{
downloadLink &&
<Button className={styles['context-menu-option-container']} title={t('CTX_DOWNLOAD_VIDEO')} onClick={copyDownloadLink}>
<Icon className={styles['menu-icon']} name={'download'} />
<div className={styles['context-menu-option-label']}>{t('CTX_COPY_VIDEO_DOWNLOAD_LINK')}</div>
</Button>
}
</div>
);
}, [copyStreamLink, onClick]);