Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Error Checking #743
Error Checking #743
Comments
|
As a Python neophyte, I can't give you a good answer, but a kludge would be --- check the output of the system call and see if it contains "ERROR" ( Of course, if youtube-dl does the standard unix thing of returning 0 on success, you could just check for that: |
|
Well, I use a simple way, checking for the downloaded file, as an error can occurs in many way (youtube-dl could fail without displaying "error", if there is any bug). In ruby, I do : def self.import_with_youtubedl(url, tmp_path)
raise StandardError.new("youtube-dl is not on the system") unless system("which youtube-dl >> /dev/null")
result = `youtube-dl -f 18 -o "#{tmp_path}/video.%(ext)s" "#{url}"`
["video.mp4", "video.flv"].each do |file_name|
file_path = tmp_path.join(file_name)
return file_path if File.exists?(file_path)
end
return nil if result =~ /Falling back on generic information extractor/i
raise StandardError.new("Cannot get with youtube-dl: #{result}")
endIt returns me the file path of the downloaded video, or nil if youtube-dl couldn't download it (all extractors tried). |
|
Thanks @maximeg and @cinereous for your suggestions! I tried @cinereous's suggestion and implemented this:
It worked! Thanks for the help! Cheers, Greg |
|
@phihag this has also been resolved (and can be closed) |
Hi,
Just started using youtube-dl -- great program! I am wondering if there is a way to check whether the video downloaded -- or at least started to.
I'm using youtube-dl within Python, and iterating over URLs in a 'video_url' column in a database, as in the following lines
all_videos = session.query(VIDEOS).all()
for row in all_videos[:20]:
campaign_name = row.charity_name
video_id = '_%(id)s.%(ext)s'
video_name = 'videos/'+campaign_name+video_id
os.system ( "youtube-dl '%s' -o '%s'" % (video_url, video_name) )
row.video_downloaded = 'yes'
Most of the time, this works great, but on at least one Vimeo video I get this error:
[vimeo] 59354216: Downloading webpage
[vimeo] 59354216: Extracting information
ERROR: unable to extract info section
So, what I'm wondering is if there is a way to check whether there is an error, or check whether the video downloaded correctly, so that I can note in the 'video_downloaded' column whether the video downloaded or not? Sorry if this is a bit of a novice question -- I'd appreciate any help!
Best,
Greg