mirror of
https://github.com/snobu/destreamer.git
synced 2026-02-22 14:28:24 +00:00
Compare commits
8 Commits
de158e3119
...
sharepoint
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e93ad80ef6 | ||
|
|
9b8d341e5b | ||
|
|
d2a79442df | ||
|
|
528dc79752 | ||
|
|
b6a06dbd82 | ||
|
|
81e7173e10 | ||
|
|
377f7281b8 | ||
|
|
71b51e76ce |
@@ -41,6 +41,7 @@ Hopefully this doesn't break the end user agreement for Microsoft Stream. Since
|
|||||||
- [**Node.js**][node]: You'll need Node.js version 8.0 or higher. A GitHub Action runs tests on all major Node versions on every commit. One caveat for Node 8, if you get a `Parse Error` with `code: HPE_HEADER_OVERFLOW` you're out of luck and you'll need to upgrade to Node 10+. PLEASE NOTE WE NO LONGER TEST BUILDS AGAINST NODE 8.x. YOU ARE ON YOUR OWN.
|
- [**Node.js**][node]: You'll need Node.js version 8.0 or higher. A GitHub Action runs tests on all major Node versions on every commit. One caveat for Node 8, if you get a `Parse Error` with `code: HPE_HEADER_OVERFLOW` you're out of luck and you'll need to upgrade to Node 10+. PLEASE NOTE WE NO LONGER TEST BUILDS AGAINST NODE 8.x. YOU ARE ON YOUR OWN.
|
||||||
- **npm**: usually comes with Node.js, type `npm` in your terminal to check for its presence
|
- **npm**: usually comes with Node.js, type `npm` in your terminal to check for its presence
|
||||||
- [**ffmpeg**][ffmpeg]: a recent version (year 2019 or above), in `$PATH` or in the same directory as this README file (project root).
|
- [**ffmpeg**][ffmpeg]: a recent version (year 2019 or above), in `$PATH` or in the same directory as this README file (project root).
|
||||||
|
- [**aria2**][aria2]: aria2 is a utility for downloading files with multiple threads, fast.
|
||||||
- [**git**][git]: one or more npm dependencies require git.
|
- [**git**][git]: one or more npm dependencies require git.
|
||||||
|
|
||||||
Destreamer takes a [honeybadger](https://www.youtube.com/watch?v=4r7wHMg5Yjg) approach towards the OS it's running on. We've successfully tested it on Windows, macOS and Linux.
|
Destreamer takes a [honeybadger](https://www.youtube.com/watch?v=4r7wHMg5Yjg) approach towards the OS it's running on. We've successfully tested it on Windows, macOS and Linux.
|
||||||
@@ -239,6 +240,7 @@ Please open an [issue](https://github.com/snobu/destreamer/issues) and we'll loo
|
|||||||
|
|
||||||
|
|
||||||
[ffmpeg]: https://www.ffmpeg.org/download.html
|
[ffmpeg]: https://www.ffmpeg.org/download.html
|
||||||
|
[aria2]: https://github.com/aria2/aria2/releases
|
||||||
[xming]: https://sourceforge.net/projects/xming/
|
[xming]: https://sourceforge.net/projects/xming/
|
||||||
[node]: https://nodejs.org/en/download/
|
[node]: https://nodejs.org/en/download/
|
||||||
[git]: https://git-scm.com/downloads
|
[git]: https://git-scm.com/downloads
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ export class ShareApiClient {
|
|||||||
AddRequiredFields: true
|
AddRequiredFields: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const url = `${this.site}/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='${filePath}'`;
|
const url = `${this.site}/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='${encodeURIComponent(filePath)}'`;
|
||||||
|
|
||||||
logger.verbose(`Requesting video info for '${url}'`);
|
logger.verbose(`Requesting video info for '${url}'`);
|
||||||
const info = await this.axiosInstance.post(url, payload, {
|
const info = await this.axiosInstance.post(url, payload, {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { CLI_ERROR, ERROR_CODE } from './Errors';
|
import { CLI_ERROR } from './Errors';
|
||||||
import { makeOutDir } from './Utils';
|
import { makeOutDir } from './Utils';
|
||||||
import { logger } from './Logger';
|
import { logger } from './Logger';
|
||||||
import { templateElements } from './Types';
|
import { templateElements } from './Types';
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import readlineSync from 'readline-sync';
|
|
||||||
import sanitize from 'sanitize-filename';
|
import sanitize from 'sanitize-filename';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
|
|
||||||
@@ -198,14 +197,3 @@ function isOutputTemplateValid(argv: any): boolean {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function promptUser(choices: Array<string>): number {
|
|
||||||
const index: number = readlineSync.keyInSelect(choices, 'Which resolution/format do you prefer?');
|
|
||||||
|
|
||||||
if (index === -1) {
|
|
||||||
process.exit(ERROR_CODE.CANCELLED_USER_INPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ export async function downloadStreamVideo(videoUrls: Array<VideoUrl>): Promise<v
|
|||||||
|
|
||||||
// TODO: complete overhaul of this function
|
// TODO: complete overhaul of this function
|
||||||
export async function downloadShareVideo(videoUrls: Array<VideoUrl>): Promise<void> {
|
export async function downloadShareVideo(videoUrls: Array<VideoUrl>): Promise<void> {
|
||||||
const shareUrlRegex = new RegExp(/(?<domain>https:\/\/.+\.sharepoint\.com)(?<baseSite>\/sites\/.*?)(?:(?<filename>\/.*\.mp4)|\/.*id=(?<paramFilename>.*mp4))/);
|
const shareUrlRegex = new RegExp(/(?<domain>https:\/\/.+\.sharepoint\.com).*?(?<baseSite>\/(?:teams|sites|personal)\/.*?)(?:(?<filename>\/.*\.mp4)|\/.*id=(?<paramFilename>.*mp4))/);
|
||||||
|
|
||||||
logger.info('Downloading SharePoint videos...\n\n');
|
logger.info('Downloading SharePoint videos...\n\n');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const enum ERROR_CODE {
|
export const enum ERROR_CODE {
|
||||||
UNHANDLED_ERROR,
|
UNHANDLED_ERROR = 200,
|
||||||
ELEVATED_SHELL,
|
ELEVATED_SHELL,
|
||||||
CANCELLED_USER_INPUT,
|
CANCELLED_USER_INPUT,
|
||||||
MISSING_FFMPEG,
|
MISSING_FFMPEG,
|
||||||
|
|||||||
12
src/Utils.ts
12
src/Utils.ts
@@ -6,6 +6,7 @@ import { StreamSession, VideoUrl } from './Types';
|
|||||||
import { AxiosResponse } from 'axios';
|
import { AxiosResponse } from 'axios';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import readlineSync from 'readline-sync';
|
||||||
|
|
||||||
|
|
||||||
const streamUrlRegex = new RegExp(/https?:\/\/web\.microsoftstream\.com.*/);
|
const streamUrlRegex = new RegExp(/https?:\/\/web\.microsoftstream\.com.*/);
|
||||||
@@ -237,3 +238,14 @@ export function ffmpegTimemarkToChunk(timemark: string): number {
|
|||||||
|
|
||||||
return (hrs * 60 * 60) + (mins * 60) + secs;
|
return (hrs * 60 * 60) + (mins * 60) + secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function promptUser(choices: Array<string>): number {
|
||||||
|
const index: number = readlineSync.keyInSelect(choices, 'Which resolution/format do you prefer?');
|
||||||
|
|
||||||
|
if (index === -1) {
|
||||||
|
process.exit(ERROR_CODE.CANCELLED_USER_INPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { StreamApiClient } from './ApiClient';
|
import { StreamApiClient } from './ApiClient';
|
||||||
import { promptUser } from './CommandLineParser';
|
import { promptUser } from './Utils';
|
||||||
import { logger } from './Logger';
|
import { logger } from './Logger';
|
||||||
import { Video, StreamSession, VideoUrl } from './Types';
|
import { Video, StreamSession, VideoUrl } from './Types';
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { StreamSession, VideoUrl } from './Types';
|
|||||||
|
|
||||||
|
|
||||||
// we cannot test groups parsing as that requires an actual session
|
// we cannot test groups parsing as that requires an actual session
|
||||||
|
// TODO: add SharePoint urls
|
||||||
describe('Destreamer parsing', () => {
|
describe('Destreamer parsing', () => {
|
||||||
it('Input file to arrays of guids', async () => {
|
it('Input file to arrays of guids', async () => {
|
||||||
const testSession: StreamSession = {
|
const testSession: StreamSession = {
|
||||||
|
|||||||
Reference in New Issue
Block a user