snobu / destreamer

Save Microsoft Stream videos for offline enjoyment.
MIT License
2.36k stars 440 forks source link

Report errors when reading URLs from a .txt file created by > operator #262

Closed Joy3van closed 3 years ago

Joy3van commented 3 years ago

Hi there,

So I was trying to download multiple videos and I used > to create a file. What I did was simply echo "[THE VIDEO LINK]" > links.txt. And when I try to use the -f option, it reported warnings that the URL is Invalid. However, the links are fine and if I paste them in a file created by Notepad, the program runs perfectly. I'm using Windows 10(2004) and running destreamer in Powershell.

Alex87a commented 3 years ago

Hi there,

So I was trying to download multiple videos and I used > to create a file. What I did was simply echo "[THE VIDEO LINK]" > links.txt. And when I try to use the -f option, it reported warnings that the URL is Invalid. However, the links are fine and if I paste them in a file created by Notepad, the program runs perfectly. I'm using Windows 10(2004) and running destreamer in Powershell.

Hi, I can tell you my experience. I use cmd and I also created a text file containing all the links (although I advise you to put only the links of the channels, the script will download all the videos in it). My .bat file looks like this: @echo off cmd /k --username "email@example.it" / -f "C: //Users/Alex/Desktop/file.txt" / -o "C: // Users / Alex / Desktop / Video ". Personally I find it very good with this form, also because everything is automated and downloads very quickly. Another piece of advice I would like to give you is to insert the command --skip (in case you put the channel link in the text file) so that no downloads are made of the same files downloaded previously.

lukaarma commented 3 years ago

Could you please run it again with the '--verbose' flag and paste here the output?

Joy3van commented 3 years ago

Hi, sorry for the late reply. I did the same with different links, here's the output

[VERBOSE] Using ffmpeg version 4.3.1-2020-10-01-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers

Access token still good for 59 minutes.

[VERBOSE] Session and API info
         API Gateway URL: https://uswe-1.api.microsoftstream.com/api/
         API Gateway version: 1.4-private

Parsing input file

[WARNING] Invalid url at line 1, skipping..

[WARNING] Invalid url at line 2, skipping..

[WARNING] Invalid url at line 3, skipping..

[VERBOSE] List of GUIDs and corresponding output directory

Fetching videos info...
snobu commented 3 years ago

Can you paste the content of your input file here please? Censor out GUIDs if necessary.

Joy3van commented 3 years ago

Hi there, So I was trying to download multiple videos and I used > to create a file. What I did was simply echo "[THE VIDEO LINK]" > links.txt. And when I try to use the -f option, it reported warnings that the URL is Invalid. However, the links are fine and if I paste them in a file created by Notepad, the program runs perfectly. I'm using Windows 10(2004) and running destreamer in Powershell.

Hi, I can tell you my experience. I use cmd and I also created a text file containing all the links (although I advise you to put only the links of the channels, the script will download all the videos in it). My .bat file looks like this: @echo off cmd /k --username "email@example.it" / -f "C: //Users/Alex/Desktop/file.txt" / -o "C: // Users / Alex / Desktop / Video ". Personally I find it very good with this form, also because everything is automated and downloads very quickly. Another piece of advice I would like to give you is to insert the command --skip (in case you put the channel link in the text file) so that no downloads are made of the same files downloaded previously.

Hi luka, thanks for your reply! I'm not familiar with batch scripts, so I'm not quite sure how your .bat file works, could you explain? Where is the ".destreamer" part?

Joy3van commented 3 years ago

Can you paste the content of your input file here please? Censor out GUIDs if necessary.

Thanks for your reply! The file actually contains nothing but pure links, just if the file is created using echo and stdout, it reports "Invalid URL". Here's a breakdown of every command I typed:

echo "https://web.microsoftstream.com/video/xxxxxxx-xxxx-xxx-xxxxxxx" > list.txt
echo "https://web.microsoftstream.com/video/yyyyyyy-yyyy-yyy-yyyyyy" >> list.txt
 .\destreamer.cmd -f .\list.txt -o E:\Videos\ --verbose

However, if I open notepad -> paste the same links -> save as xxx.txt, and use this as input file. It works perfectly fine.

Alex87a commented 3 years ago

Salve, quindi stavo cercando di scaricare più video e ho usato> per creare un file. Quello che ho fatto è stato semplicemente echo "[THE VIDEO LINK]" > links.txt. E quando provo a utilizzare l'opzione -f, vengono segnalati avvisi che l'URL non è valido. Tuttavia, i collegamenti vanno bene e se li incollo in un file creato da Blocco note, il programma funziona perfettamente. Sto usando Windows 10 (2004) e sto eseguendo destreamer in Powershell.

Ciao, posso raccontarti la mia esperienza. Uso cmd e ho anche creato un file di testo contenente tutti i link (anche se ti consiglio di mettere solo i link dei canali, lo script scaricherà tutti i video al suo interno). Il mio file .bat ha questo aspetto: @echo off cmd / k --username " email@example.it " / -f "C: //Users/Alex/Desktop/file.txt" / -o "C: // Utenti / Alex / Desktop / Video ". Personalmente trovo molto buono questo form, anche perchè è tutto automatizzato e si scarica molto velocemente. Un altro consiglio che vorrei darvi è di inserire il comando --skip (nel caso mettiate il link al canale nel file di testo) in modo che non vengano effettuati download degli stessi file scaricati in precedenza.

Ciao luka, grazie per la tua risposta! Non ho familiarità con gli script batch, quindi non sono abbastanza sicuro di come funzioni il tuo file .bat, potresti spiegarmi? Dov'è la parte ".destreamer"?

You're right, I'm a fool! I'll show you my complete .bat file, with it just click on it and it will download everything automatically. For a few weeks I have directly entered the link of the Team and I must tell you that a bomb goes! After a few lessons I start the .bat file and, thanks to the --skip command, avoid re-downloading the same lessons but download the new ones (super fast!).

Copy this code:

@echo off cd C:\Users\Alex\Desktop\destreamer cmd /k destreamer -f "C:\Users\Alex\Desktop\1.txt" \ -u "yourEmail@students" \ -o "C:\Users\Alex\Desktop" \ --format "mp4" \ -k \ --skip pause

Obviously substitute your various paths in place of mine!

1) With the command -f I extracted the files contained on a text file created on the Desktop. 2) With the -u command I entered my institutional email address. 3) With the -o command I made the script download the videos to a specific folder on the Desktop. 4) With the --format command I changed the format of the downloaded videos from mvk to mp4. 5) With the command -k I have kept the login cookies on Chronium, so that I don't have to rewrite the password every time. 6) With the --skip command, as mentioned earlier, I avoided downloading files with the same names multiple times.

I hope I've been of help, I'm new to the world of GitHub and many things that maybe for you are taken for granted for me are not, so for safety I wanted to write what I do in detail.

lukaarma commented 3 years ago

However, if I open notepad -> paste the same links -> save as xxx.txt, and use this as input file. It works perfectly fine.

The echo command creates artifacts and formats each char with 2 bytes and I think it's screwing with node reading the file properly Use notepad or any editor and this is solved

snobu commented 3 years ago

@lukaarma this is most probably an encoding problem. Do we assume UTF-8 when we load the text file for parsing?

lukaarma commented 3 years ago

Yeah it's for sure that @snobu , we assume utf-8 so it's parsed directly to string...we could create a reader and read from that in some way? I'll have to look up node docs about fs when I can