snobu / destreamer

Save Microsoft Stream videos for offline enjoyment.
MIT License
2.37k stars 439 forks source link

Sharepoint.com #380

Open safresh0999 opened 3 years ago

safresh0999 commented 3 years ago
First of all, thank you for the work you have done. Is there any hope that the project will be updated, allowing downloads from sharepoint.com? (some professors do not allow download of videos...)
carlosmendes-7 commented 3 years ago

This subject has been addressed in issue #275

palmerj commented 3 years ago

Note that in the last few weeks I've noticed a change where you can't even download the videos from sharepoint. Looks like only the organiser can.

Q1 of 2021, only the meeting recorder and organizer will be able to download the meeting recording. All other attendees will only be able to view it.

https://support.microsoft.com/en-us/office/play-and-share-a-meeting-recording-in-teams-7d7e5dc5-9ae4-4b94-8589-27496037e8fa#bkmk_downloadmeetingrecording

q7z commented 3 years ago

Bumping the last comment by @palmerj

GeeWee commented 3 years ago

Can confirm that destreamer no longer works for meeting recordings as they are shared in Sharepoint now.

Valeri0p commented 3 years ago

As mentioned in #275 someone has developed a new tool, but in the meantime we've been using a workaround to open the video files directly:

The link structure should be something like this: https://[ORGANIZATION].sharepoint.com/sites/[FOLDER NAME, USUALLY THE NAME OF THE TEAM GROUP OR SUBJECT]/Shared%20Documents/General/Recordings/[FILENAME OF THE RECORDING WITH %20 INSTEAD OF SPACES (or other ascii to utf-8 codes)].mp4

If you only have a link to the sharepoint player you can try to recover the direct link to the mp4 file by using some website like https://www.url-encode-decode.com/ to remove the utf-8 to ascii encoding and then editing the url to look like the example above. (no need to convert it back when opening the new url btw).

Scusate per la grammatica ma l'ho scritto un po di fretta ๐Ÿ˜…

snobu commented 3 years ago

Looks like this shouldn't take too much effort to implement into destreamer. Will take a look. Thanks for your writeup, appreciate the effort.

Valeri0p commented 3 years ago

You are welcome ๐Ÿ˜Š ("writeup", รจ giusto la descrizione di un url ๐Ÿ˜…) Just so you know, "General" was the name of the channel, and the folder "Recordings" might not have the same name for everyone.

Honestly I don't know how universal this method is, maybe it only works in my organization because of some oversight when setting up the privileges. I haven't looked at their code, but I assume @kylon 's software might be more robust and harder to patch for Microsoft seeing the presence of FFmpeg to obtain the video stream (I guess).

wad11656 commented 3 years ago

As mentioned in #275 someone has developed a new tool, but in the meantime we've been using a workaround to open the video files directly:

  • Go to the "Files" section of your teams channel;
  • Open the "Recordings" folder;
  • Right click on the video file and select copy link;
  • You should get a direct link to the .mp4 file, you can view it in your browser or download it, no restrictions.

The link structure should be something like this: https://[ORGANIZATION].sharepoint.com/sites/[FOLDER NAME, USUALLY THE NAME OF THE TEAM GROUP OR SUBJECT]/Shared%20Documents/General/Recordings/[FILENAME OF THE RECORDING WITH %20 INSTEAD OF SPACES (or other ascii to utf-8 codes)].mp4

If you only have a link to the sharepoint player you can try to recover the direct link to the mp4 file by using some website like https://www.url-encode-decode.com/ to remove the utf-8 to ascii encoding and then editing the url to look like the example above. (no need to convert it back when opening the new url btw).

Scusate per la grammatica ma l'ho scritto un po di fretta ๐Ÿ˜…

After a bunch of fenagling I finally got a url that ends in .mp4 (https://companyName-my.sharepoint.com/:v:/r/personal/employeeName_companyName_com/Documents/Recordings/Company%20Meeting-20210712-Meeting%20Recording.mp4) but I get a "Sorry, you don't have access." I'm just trying to download our Team meeting recording :

image

Valeri0p commented 3 years ago

Yeah I saw links with the :v:sometimes in the link generated inside the chat, they don't contain the full path. Again it probably depends on how the organization has set up its privileges.

When I get my url from Sharepoint or the Files section on Teams I get this: (after going trough https://www.url-encode-decode.com/) https://[ORG].sharepoint.com/sites/[TEAM NAME]/Shared Documents/Forms/AllItems.aspx?id=/sites/[TEAM NAME]/Shared Documents/General/Recordings/[FILENAME].mp4&parent=/sites/[TEAM NAME]/Shared Documents/General/Recordings

That can be edited into this: https://[ORG].sharepoint.com/sites/[TEAM NAME]/Shared Documents/General/Recordings/[FILENAME].mp4

[ORG] is already present int the url, [TEAM NAME] should be easy to recover, "General/Recordings/" might change as I said up there and [FILENAME] if not apparent int the url is obtainable by opening the details section of the Sharepoint player; It's mostly custom but it look something like: [Custom part by the organizer] [dd.mm.aa date]-[aaaammdd, basically ISO 8601-like date]_[hhmmss time]-Meeting Recording.mp4

...also by looking at that "other details" section there's a button that says "copy direct link" (it's in italian so idk the exact name ๐Ÿ˜…)

MaschineBrennt commented 2 years ago

It doesn't work with sharepoint

tuchang commented 2 years ago

Anyone checked pull request above? does it work? Should I take any extra steps?

lukaarma commented 2 years ago

@tuchang It's an alpha so it's a bit unstable and not well tested, but it should work. If you want to try it and give some feedback that would be really appreciated

@snobu Can we do a quick readme edit to let people know of the new branch? I need feedback if it's working or not

DaniDiaz71 commented 2 years ago

Under OSX:

[FATAL ERROR] Aria2 is missing!
Destreamer requires a fairly recent release of Aria2 to download videos 

But aria2c is present:

% which aria2c
/opt/local/bin/aria2c
marcosrgu2081 commented 2 years ago

Under OSX:

[FATAL ERROR] Aria2 is missing!
Destreamer requires a fairly recent release of Aria2 to download videos 

But aria2c is present:

% which aria2c
/opt/local/bin/aria2c

I've tried today installing it via homebrew (brew install aria2) and I skipped this error, but I still having some issues: It doesn't recognize the url or saying that I haven't access

lukaarma commented 2 years ago

@DaniDiaz71 Could you try to copy aria2 into Destreamer's folder and run it again please

@marcosrgu2081 What could you copy and paste the url and the error here? You made sure that you are using the correct branch?

marcosrgu2081 commented 2 years ago

@marcosrgu2081 What could you copy and paste the url and the error here? You made sure that you are using the correct branch?

Sorry, It was my fault (I was using the incorrect url)

DaniDiaz71 commented 2 years ago

@DaniDiaz71 Could you try to copy aria2 into Destreamer's folder and run it again please

@marcosrgu2081 What could you copy and paste the url and the error here? You made sure that you are using the correct branch?

Did it, but same error.

darderik commented 2 years ago

The issue related to invalid urls seems to be located in this regex check Screenshot (22)_LI

I don't know if I got the regex right, but this is what I wrote in order to match correctly the url

(?<domain>https:\/\/.+\.sharepoint\.com).+?(?<basesite>\/sites\/.+?)(?:(?<filename>\/.*\.mp4)|\/.*id=(?<paramFilename>.*mp4)) (slightly different from the one used in next picture)

Screenshot (19)_LI

Unfortunately, this resulted in another error . Screenshot (20)

lukaarma commented 2 years ago

Unfortunately, this resulted in another error . Screenshot (20)

@darderik could you please run it again with the --verbose flag and post the output?

I see that your link includes the drive letter and i need to see what kind of request to the backend are being made

lukaarma commented 2 years ago

@DaniDiaz71 Could you try to copy aria2 into Destreamer's folder and run it again please @marcosrgu2081 What could you copy and paste the url and the error here? You made sure that you are using the correct branch?

Did it, but same error.

@DaniDiaz71 This may be an exit code collision that was fixed on another branch. I pushed an update to the Sharepoint branch, pull and build again please, that test again. It's also true that we had issue with path in macos (see #146) that I now notice was never fixed..

Try to update the branch and let me know, if the error persist I'll dig deeper in this issue

darderik commented 2 years ago

Unfortunately, this resulted in another error . Screenshot (20)

@darderik could you please run it again with the --verbose flag and post the output?

I see that your link includes the drive letter and i need to see what kind of request to the backend are being made

Of course, here it is. I'd like to point out that i'm currently using the regular expression of my previous answer,due to the fact that these urls with the drive are getting marked as invalid from the previous regex. Screenshot (23)_LI

Regex test Screenshot (25)_LI

lukaarma commented 2 years ago

I'd like to point out that i'm currently using the regular expression of my previous answer,due to the fact that these urls with the drive are getting marked as invalid from the previous regex.

You did the right thing! I suspect that since since your regex result includes the drive letter that is screwing with the rest of the logic, enche the undefined in the requested url. Please try this regex (?<domain>https:\/\/.+\.sharepoint\.com).*?(?<baseSite>\/(?:teams|sites)\/.*?)(?:(?<filename>\/.*\.mp4)|\/.*id=(?<paramFilename>.*mp4)) and let me know if it works

darderik commented 2 years ago

I'd like to point out that i'm currently using the regular expression of my previous answer,due to the fact that these urls with the drive are getting marked as invalid from the previous regex.

You did the right thing! I suspect that since since your regex result includes the drive letter that is screwing with the rest of the logic, enche the undefined in the requested url. Please try this regex (?<domain>https:\/\/.+\.sharepoint\.com).*?(?<baseSite>\/(?:teams|sites)\/.*?)(?:(?<filename>\/.*\.mp4)|\/.*id=(?<paramFilename>.*mp4)) and let me know if it works

EDIT: ignore this I just saw the last regex you posted

Your regex works like a charm! I definitely screwed it up (ignore the error it's because i killed the process) Screenshot (26)

P.s: Mamma mia sono proprio una sega con le regex

lukaarma commented 2 years ago

Nice, happy that it worked @darderik ! Don't beat yourself about regex, they can be complex! It took me years to properly learn them.

I pushed an updated version to the Sharepoint branch

snobu commented 2 years ago

@lukaarma can you check one thing please. With your new branch, when you get the API URL formed, dump the JSON output for the streams, you know the one that gives you the HLS and MPEG-DASH URLs. Check if you now have progressive download URL as well. Since SharePoint isn't Azure Media Services i'm hoping progressive download is exposed by default but not surfaced to the end users.

If that exists, we can dramatically simplify everything, as in drop both ffmpeg and aria.

DaniDiaz71 commented 2 years ago

@DaniDiaz71 Could you try to copy aria2 into Destreamer's folder and run it again please @marcosrgu2081 What could you copy and paste the url and the error here? You made sure that you are using the correct branch?

Did it, but same error.

@DaniDiaz71 This may be an exit code collision that was fixed on another branch. I pushed an update to the Sharepoint branch, pull and build again please, that test again. It's also true that we had issue with path in macos (see #146) that I now notice was never fixed..

Try to update the branch and let me know, if the error persist I'll dig deeper in this issue

Doesn't work :( I've downloaded last update, install&build, copy ffmpeg and aria2c to Destreamer's folder and update $PATH var. But destreamer does not find aria2c file. I had same problem with ffmpeg but solved it copy ffmpeg file to Destreamer's folder, I don't understand why this workaround doesn't work with aria2c. The only difference between both files are 'which' command, because which ffmpeg show me the file at Destreamer's folder while which aria2c show it at /opt/local/bin/ SOLVED!: Remove aria2c from /opt/local/bin/ now find it at /usr/local/bin/ and works.

Now i have other issue at validation phase:

Downloading SharePoint videos...
Launching headless Chrome to perform the OpenID Connect dance...
Navigating to login page...
Waiting for target!
We are logged in.
[FATAL ERROR] Could not evaluate sessionInfo on the page 

I guess i shoud open new issue..., it seems to be a timeout problem because Chrome close it when i'm writing password or second authentication factor.

snqqyj commented 2 years ago

@lukaarma Thank you so much for your efforts for the SharePoint branch.

But in our company, now the url of the online video for meeting recording changed to something like below: https://xxxxxx-my.sharepoint.com/%3Av%3A/g/personal/xxxxxx_xxxxxx_xxxxxx_com/EQ5y7SkmWbRDtzS0uE3Rd2sBjxHSkc_GkbzTx9PreCrXig

It seems that the latest SharePoint branch of DeStreamer couldn't support this kind of url. Hope someone could help update/enhance the SharePoint branch.

darderik commented 2 years ago

Hello everybody, just wanted to point out a minor issue related to the skipping of existing videos

On this line, aside from the unused call to createUniquePath , a check for an eventual existing file should be added

    for (const [index, video] of videos.entries()) {
     if (argv.skip && fs.existsSync(video.outPath)) {
            logger.info(`File already exists, skipping: ${video.outPath} \n`);
            continue;
        }
...
gionac commented 2 years ago

Hello everybody, I'm using destreamer to download some videos from sharedpoint. The wird thing is i can downlaod without problmes videos that were recorded until last week, but with the recordings of this week I'm receiving this error:

 [ERROR] Error: Request failed with status code 404
    at createError (C:\devepolpents\destreamer\node_modules\axios\lib\core\createError.js:16:15)
    at settle (C:\devepolpents\destreamer\node_modules\axios\lib\core\settle.js:17:12)
    at IncomingMessage.handleStreamEnd (C:\devepolpents\destreamer\node_modules\axios\lib\adapters\http.js:269:11)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

[FATAL ERROR] Unhandled error!
Timeout or fatal error, please check your downloads directory and try again`
...

It seems that with the videos of this week destreamer is unable to find the .mp4 file in the page code... Does anyone have any diea of why?

Thank you for your work!

lukaarma commented 2 years ago

@lukaarma can you check one thing please. With your new branch, when you get the API URL formed, dump the JSON output for the streams,

@snobu I could not find something like that but I'll e-mail you a couple of json I got so that you could take a look. When I have more time I'll dig more into the api to see if I missed something.

it seems to be a timeout problem because Chrome close it when i'm writing password or second authentication factor.

@DaniDiaz71 Could you please make sure that you are on the latest version of the Sharepoint branch? There was an error during the login process that should have been fixed, if you are on the latest branch and you are still having trouble loggin in please open a separate issue.

But in our company, now the url of the online video for meeting recording changed to something like below: https://xxxxxx-my.sharepoint.com/%3Av%3A/g/personal/xxxxxx_xxxxxx_xxxxxx_com/EQ5y7SkmWbRDtzS0uE3Rd2sBjxHSkc_GkbzTx9PreCrXig

@snqqyj if you are comfortable enough to share the complete url with me via the e-mail you find on my profile it would be great and really help me. If you don't want could you at least tell me if it ends with '.mp4'

The wird thing is i can downlaod without problmes videos that were recorded until last week, but with the recordings of this week I'm receiving this error:

@gionac Was there any change in the url of the video between last week and this one? Could you please check.

@darderik I hid your comment because I created a dedicate issue, see #415

tipicoenlauniFB commented 2 years ago

I have the same problem. I can't download videos since this week.

gionac commented 2 years ago

@gionac Was there any change in the url of the video between last week and this one? Could you please check.

@lukaarma I copy there the two links. The first (newer) doesn't work, instead the second works like charm..

[...]/L1%20-%20relativit%C3%A0%20e%20Locard%20-%20L2%20-%2020211026_152611-Meeting%20Recording.mp4?csf=1&web=1&e=XxMFGP

[...]/L0-lab-20211005_160042-Meeting%20Recording.mp4?csf=1&web=1&e=7E0Pk7

I omitted the first because it's identical

lukaarma commented 2 years ago

I omitted the first because it's identical

@gionac could you please open a new issue and provide me the full verbose output of your command (add -- verbose to your command) I don't see anything special in your link so it may be something else

gionac commented 2 years ago

I omitted the first because it's identical

@gionac could you please open a new issue and provide me the full verbose output of your command (add -- verbose to your command) I don't see anything special in your link so it may be something else

I did a new issue here, with the verbose output, here: https://github.com/snobu/destreamer/issues/416

Thank you @lukaarma !

martingercke commented 2 years ago

I also had an issue with personal videos. I needed to add "personal" to the list: const shareUrlRegex = new RegExp(/(?https:\/\/.+.sharepoint.com).?(?\/(?:teams|sites|personal)\/.?)(?:(?\/..mp4)|\/.id=(?.*mp4))/);

muzso commented 2 years ago

I also had an issue with personal videos. I needed to add "personal" to the list: const shareUrlRegex = new RegExp(/(?https://.+.sharepoint.com)._?(?/(?:teams|sites|personal)/._?)(?:(?/.*.mp4)|/.*id=(?.*mp4))/);

Same here. After adding "|personal" to the regex, download started to work (even for videos where I have no download permission). Thanks!

WilliamWsyHK commented 2 years ago

Thanks for @muzso advise, and I have created a PR base on this, as well to include a small fix on the file name with characters that requires encodeURIComponent-ed.