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

'%(uri)s' as part of --output TEMPLATE options ... #414

Closed
Albretch opened this issue Sep 6, 2012 · 9 comments
Closed

'%(uri)s' as part of --output TEMPLATE options ... #414

Albretch opened this issue Sep 6, 2012 · 9 comments
Assignees

Comments

@Albretch
Copy link

@Albretch Albretch commented Sep 6, 2012

I keep an updated local cache of some videos on youtube (to use them in classes)
~
I have noticed that youtube users are able to edit their video titles (as the free text entry it is) so sometimes I have mistakenly dowloaded what is exactly the same video
~
The only way I see around that problem is to use the URI (the 11 Base64(?) characters) and download the description as well via "--write-description", but as part of the --output TEMPLATE options I don't see something like '%(uri)s'
~
Of course, you could use a script and parse that piece of text, but restarting a youtube process for each uri is a waste
~
How do you work around this problem? Or could you include such an option?
~
thanks
lbrtchx
github.com/rg3/youtube-dl/:
~
// __ exact command line:

export _ODIR="/media/sda1/yt"
export _IFL="/media/sda1/yturls.txt"

export _DT=date +%Y%m%d%H%M%S

date
youtube-dl --verbose --no-overwrites --continue --no-progress --console-title --prefer-free-formats --audio-format best --max-quality mp4 --write-description -o --cookies cookies_jar.txt "${_ODIR}/"'%(uploader)s'"/"'%(stitle)s'.'%(ext)s' --batch-file "${_IFL}" >> "${_ODIR}/"${_DT}_yt.log.txt 2>&1
date
~
$ youtube-dl --version
2012.02.27
~
$ python --version
Python 2.7.3rc2
~
// __ Operating System

$ uname -a
Linux Microknoppix 3.3.7 #38 SMP PREEMPT Tue May 22 06:21:01 CEST 2012 i686 GNU/Linux

@Albretch
Copy link
Author

@Albretch Albretch commented Sep 8, 2012

for example, both lessons are (exactly) called "Cognitive Science C103 - Lecture 15" ...
~
youtube.com/watch?v=VM-8A5Jmo7c
~
youtube.com/watch?v=sA9fazTAOyE
~
lbrtchx

@Albretch Albretch closed this Sep 8, 2012
@Albretch
Copy link
Author

@Albretch Albretch commented Sep 8, 2012

I didn't mean to "close" the issue, but the window ;-)
~
lbrtchx

@Albretch Albretch reopened this Sep 8, 2012
@Albretch
Copy link
Author

@Albretch Albretch commented Sep 8, 2012

I know if you go

$ youtube-dl --verbose http://www.youtube.com/watch?v=sA9fazTAOyE

you will get (as I want) the file name as the youtube URI (the "sA9fazTAOyE" part) and the extension of the downloaded file, but given a list of youtube URLs (which "user(s)" I have no way of knowing before hand), I am trying to download each othe files to a folder named after the youtube uploader/user as named in:

youtube.com/user/...
~
$ _ODIR="/media/sdc1/yt"
$ _DT=date +%Y%m%d%H%M%S
$ _OFL=${ODIR}"/yt-dl"${_DT}".log.txt"
$ echo "// __ logging to "${_OFL}
// __ logging to /media/sdc1/yt/yt-dl_20120908132045.log.txt

$ date
Sat Sep 8 13:20:45 UTC 2012
$ youtube-dl --no-overwrites --continue --no-progress --console-title --verbose --audio-format best --max-quality mp4 -o "${_ODIR}/"'%(uploader)s' "http://www.youtube.com/watch?v=sA9fazTAOyE&hd=1" > ${_OFL} 2>&1
$ date
Sat Sep 8 13:20:46 UTC 2012

$ cat ${_OFL}
[debug] Proxy map: {}
[youtube] Setting language
[youtube] sA9fazTAOyE: Downloading video webpage
[youtube] sA9fazTAOyE: Downloading video info webpage
[youtube] sA9fazTAOyE: Extracting video information
~
and nothing happens. I can't even find any error log
lbrtchx

@Chronial
Copy link

@Chronial Chronial commented Nov 28, 2012

why don’t you just use %(id)s?

@Albretch
Copy link
Author

@Albretch Albretch commented Nov 28, 2012

On 11/27/12, Chronial notifications@github.com wrote:

why don’t you just use %(id)s?
~
'%(id)s' worked exactly as I needed. Thank you
~
$ youtube-dl --no-overwrites --continue --no-progress --console-title
--audio-format best --max-quality mp4 -o
'%(uploader)s'"/"'%(id)s'.'%(ext)s'
"http://www.youtube.com/watch?v=d020hcWA_Wg&hd=1"
[youtube] Setting language
[youtube] d020hcWA_Wg: Downloading video webpage
[youtube] d020hcWA_Wg: Downloading video info webpage
[youtube] d020hcWA_Wg: Extracting video information
[download] Destination: ColdplayVEVO/d020hcWA_Wg.mp4
[download] Download completed
knoppix@Microknoppix:~$ cd ColdplayVEVO/

$ ls -l d020hcWA_Wg.mp4
-rw-r--r-- 1 knoppix knoppix 55857786 May 27 2011 d020hcWA_Wg.mp4

$ ffprobe d020hcWA_Wg.mp4
avprobe version 0.8.2-6:0.8.2-2, Copyright (c) 2007-2011 the Libav developers
built on May 16 2012 19:58:09 with gcc 4.7.0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd020hcWA_Wg.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2011-05-26 15:44:38
Duration: 00:04:17.48, start: 0.000000, bitrate: 1735 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720, 1579
kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 151 kb/s
Metadata:
creation_time : 2011-05-26 15:44:38
~
Now, was it included, after my post?
~
lbrtchx

@Chronial
Copy link

@Chronial Chronial commented Nov 28, 2012

nope, always been there

@Albretch
Copy link
Author

@Albretch Albretch commented Nov 29, 2012

nope, always been there
~
Then, thanks. It may be I wasn't getting something right. My original
post was about '%(id)s' not working with the --batch-file option. It
does now:
~
$ date; youtube-dl --no-overwrites --continue --no-progress
--console-title --audio-format best --max-quality mp4 -o
'%(uploader)s'"/"'%(id)s'.'%(ext)s' --batch-file yt_urls.txt; date
Thu Nov 29 11:03:33 UTC 2012
[youtube] Setting language
[youtube] d020hcWA_Wg: Downloading video webpage
[youtube] d020hcWA_Wg: Downloading video info webpage
[youtube] d020hcWA_Wg: Extracting video information
[download] Destination: ColdplayVEVO/d020hcWA_Wg.mp4
[download] Download completed
[youtube] 8hI_rBJ72qg: Downloading video webpage
[youtube] 8hI_rBJ72qg: Downloading video info webpage
[youtube] 8hI_rBJ72qg: Extracting video information
[download] Destination: TransmissionRec/8hI_rBJ72qg.flv
[download] Download completed
Thu Nov 29 11:07:54 UTC 2012

$ cat yt_urls.txt
http://www.youtube.com/watch?v=d020hcWA_Wg&hd=1
http://www.youtube.com/watch?v=8hI_rBJ72qg&hd=1

$ find . -type f -printf "%p %s %As\n"
/media/sdb5/tmp/knoppix/test/ColdplayVEVO/d020hcWA_Wg.mp4 55857786 1354187109
/media/sdb5/tmp/knoppix/test/TransmissionRec/8hI_rBJ72qg.flv 18937643 1354187274
~
lbrtchx

@ocisly
Copy link
Contributor

@ocisly ocisly commented May 23, 2014

@phihag according to the OP, this has been resolved. close?

@phihag
Copy link
Contributor

@phihag phihag commented May 23, 2014

@codesparkle Thank you very much for your diligent work!

Yes, this has been solved. Either use %(id)s or %(webpage_url)s in the filename template.

@phihag phihag closed this May 23, 2014
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
5 participants
You can’t perform that action at this time.