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

Can't download first video that matches filter, with --max-downloads set to 1 #16116

Closed
JonasCz opened this issue Apr 7, 2018 · 1 comment
Closed

Comments

@JonasCz
Copy link

@JonasCz JonasCz commented Apr 7, 2018

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.04.03. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • [ x] I've verified and I assure that I'm running youtube-dl 2018.04.03

Before submitting an issue make sure you have:

  • [x ] At least skimmed through the README, most notably the FAQ and BUGS sections
  • [x ] Searched the bugtracker for similar issues including closed ones
  • [x ] Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • [ x] Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • [x ] Question
  • Other

Description of your issue, suggested solution and other information


I'm writing a movie trailer downloader tool, using youtube-dl for downloading. I want to download the first video result (which matches a set of filters) for a given YouTube search string. So far, I'm using this:

youtube-dl ytsearch:"180° South: Conquerors of the Useless 2010 trailer" --match-filter "duration <= 360" --max-downloads 1

This gives me:

[youtube:search] query "180° South: Conquerors of the Useless 2010 trailer": Downloading page 1
[download] Downloading playlist: 180° South: Conquerors of the Useless 2010 trailer
[youtube:search] playlist 180° South: Conquerors of the Useless 2010 trailer: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
[youtube] mqhh7c1SUHY: Downloading webpage
[youtube] mqhh7c1SUHY: Downloading video info webpage
[youtube] mqhh7c1SUHY: Extracting video information
[download] 180° South does not pass filter duration <= 360, skipping ..
[download] Finished downloading playlist: 180° South: Conquerors of the Useless 2010 trailer

...Which does not actually download anything, since the first result does not match the filter (video too long), and once the video info page has been downloaded, it seems to count as a download, and, since I have max-downloads set to 1, it does not go on to try the next video in the search results.

Is there a way to make this work ?

If there isn't, I think it might be worthwhile to make --max-downloads track the videos that were actually downloaded, and not include the ones that failed the filters. (?)

@JonasCz
Copy link
Author

@JonasCz JonasCz commented Apr 7, 2018

Nevermind, I didn't realize I had to put a count after ytsearch, using ytsearch10: now and it works.

@JonasCz JonasCz closed this Apr 7, 2018
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
1 participant
You can’t perform that action at this time.