Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "filename" when using youtube-dl embedded in a script #5117

Closed
GijsTimmers opened this issue Mar 3, 2015 · 3 comments
Closed

Error: "filename" when using youtube-dl embedded in a script #5117

GijsTimmers opened this issue Mar 3, 2015 · 3 comments

Comments

@GijsTimmers
Copy link

@GijsTimmers GijsTimmers commented Mar 3, 2015

I'm using youtube-dl 2015.03.03.1 on Ubuntu 14.04. I want to use youtube-dl in an embedded way to extract the audio from YouTube videos.

Please consider the following script (test.py):

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from youtube_dl import YoutubeDL

def show_status(d):
    if d["status"] == "downloading":
        print "Downloading..."
        print d["filename"]
        sys.stdout.flush()
    else:
        print "Done:"
        print d["filename"]
        sys.stdout.flush()

ydl = YoutubeDL({"restrictfilenames": True, \
                 "ignoreerrors": True, \
                 "nooverwrites": True, \
                 "prefer_ffmpeg": True, \
                 "progress_hooks": [show_status], \
                 "quiet": True, \
                 "outtmpl": "%(upload_date)s_%(title)s.%(ext)s", \
                 "format": "bestaudio/best",
                 "postprocessors": [{
                     "key": "FFmpegExtractAudio",
                     "preferredcodec": "mp3"}]})

ydl.download(["BaW_jenozKc"])

Now run it:

[user@pc testytdl]$ python test.py 
Downloading...
20121002_youtube-dl_test_video.m4a
Downloading...
20121002_youtube-dl_test_video.m4a
Downloading...
20121002_youtube-dl_test_video.m4a
Downloading...
20121002_youtube-dl_test_video.m4a
Downloading...
20121002_youtube-dl_test_video.m4a
Downloading...
20121002_youtube-dl_test_video.m4a
Downloading...
20121002_youtube-dl_test_video.m4a
Downloading...
20121002_youtube-dl_test_video.m4a
Downloading...
20121002_youtube-dl_test_video.m4a
Done:
ERROR: 'filename'

After running it, the directory contains a new file, 20121002_youtube-dl_test_video.m4a.part, which is 315992 bytes in size. The desired mp3 file is not there.

@jaimeMF jaimeMF closed this in 1233973 Mar 3, 2015
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Mar 3, 2015

Thanks for the report, it will work in the next version.

@GijsTimmers
Copy link
Author

@GijsTimmers GijsTimmers commented Mar 3, 2015

Thank you!

@GijsTimmers
Copy link
Author

@GijsTimmers GijsTimmers commented Mar 10, 2015

It works now, thank you for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.