Fix video import of some youtube videos

pull/1104/merge
Chocobozzz 2018-09-26 15:55:45 +02:00
parent 542e73a26b
commit cc68049424
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 6 additions and 2 deletions

View File

@ -32,7 +32,7 @@ export class MenuComponent implements OnInit {
private serverService: ServerService, private serverService: ServerService,
private redirectService: RedirectService, private redirectService: RedirectService,
private themeService: ThemeService, private themeService: ThemeService,
private hotkeysService: HotkeysService private hotkeysService: HotkeysService
) {} ) {}
ngOnInit () { ngOnInit () {

View File

@ -18,6 +18,10 @@ export type YoutubeDLInfo = {
thumbnailUrl?: string thumbnailUrl?: string
} }
const processOptions = {
maxBuffer: 1024 * 1024 * 10 // 10MB
}
function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> { function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> {
return new Promise<YoutubeDLInfo>(async (res, rej) => { return new Promise<YoutubeDLInfo>(async (res, rej) => {
const options = opts || [ '-j', '--flat-playlist' ] const options = opts || [ '-j', '--flat-playlist' ]
@ -44,7 +48,7 @@ function downloadYoutubeDLVideo (url: string) {
return new Promise<string>(async (res, rej) => { return new Promise<string>(async (res, rej) => {
const youtubeDL = await safeGetYoutubeDL() const youtubeDL = await safeGetYoutubeDL()
youtubeDL.exec(url, options, err => { youtubeDL.exec(url, options, processOptions, err => {
if (err) return rej(err) if (err) return rej(err)
return res(path) return res(path)