Skip to content

Bug: "Failed to execute 'json' on 'Response': Unexpected end of JSON input" when downloading Canvas-embedded OneDrive video #129

Description

@Juicycodeteam

Environment

Sharedown version: Latest release (built from source today, Feb 22 2026)
OS: macOS (Apple Silicon, arm64)
Build command: CSC_IDENTITY_AUTO_DISCOVERY=false npm run dist
Node/npm: Node 20.x

Description
When attempting to download a SharePoint/OneDrive video that is embedded in a Canvas LMS course page, Sharedown throws the following error:
Failed to execute 'json' on 'Response': Unexpected end of JSON input
pptr:evaluate;
_getSpItmUrlFromApiRequest%20(%2FUsers%2F%2FSharedown%2Fdist%2Fmac-arm64%2Fsharedown.app%2FContents%2FResources%2Fapp.asar%2Fpreload.js%3A289%3A27): 2:70
Steps to Reproduce

Open Sharedown
Log in with university Microsoft account (authentication completes successfully)
Paste the video URL in one of the following formats:

https://-my.sharepoint.com/personal//_layouts/15/stream.aspx?UniqueId=
https://-my.sharepoint.com/personal//_layouts/15/embed.aspx?UniqueId=&embed=...&referrer=StreamWebApp&referrerScenario=EmbedDialog.Create

Click download
Error dialog appears immediately

Context

The videos are hosted on a university OneDrive and embedded in Canvas LMS via iframe
The video player uses oneDrive.transcode API (fMP4 segmented streaming), not the traditional videomanifest endpoint
In Chrome DevTools, only oneDrive.transcode requests with part=mediasegment are visible — no videomanifest URL appears even after multiple page reloads
The videos are view-only (download disabled by the instructor)

Expected Behavior
Sharedown should detect the video stream and download it successfully.
Additional Info
The error originates from preload.js:289:27 in the _getSpItmUrlFromApiRequest function, suggesting the API response that Sharedown expects to parse as JSON is either empty or returning an unexpected format.
Happy to provide any additional logs or debugging info if needed. Thanks for maintaining this great tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions