Using the 'NA' string when an item is unavailable would break with format specifiers such as {playlist_index:03} or {upload_date:%Y} since strings don't allow those formatters.
Instead of using 'NA', use a class that always returns 'NA' on str() or format().
(The str() part can probably be removed; it's just in case %s is used somewhere else in the code, now or in a future.)
Also, renamed class _Int_digits to a more meaningful and consistent _Int_formatter.
{autonumber} and {playlist_index} are now integers rather than strings, so {autonumber:02} works and you don't need --autonumber-size.
(Actually, they're "special integers" that get printed to a predefined fixed width if you leave the :02 out; see the _Int_digits class.)
{upload_date} is now a datetime.date, so {upload_date:%b %Y} will format as "Oct 2015" (default is "2015-10-19").
sanitize() gets applied only to string values, not to numeric ones (or dates or lists or...)
- Edited __init__.py so that it uses the new {NAME} rather than the old %(NAME)s --output format
- Moved the backwards compatibility code from YoutubeDL.py to __init__.py
- Display a warning if the old format is used
When using 'bestvideo/best,bestaudio', 'bestvideo/best' must be set as the current_selector (instead of appending it to the selectors), otherwise when it gets the ',' it would append 'None' to the selectors.
'bestvideo+bestaudio/best' was incorrectly interpreted as 'bestvideo+(bestaudio/best)', so it would fail if 'bestaudio' doesn't exist instead of falling back to 'best'.
The spec string is processed using 'tokenize.tokenize' to split it in words and operators, the filters are still processed using regular expressions.
This should make easier to allow grouping operators with parens.
For some extractors that are hard to workout a good _VALID_URL we use very vague and unrestrictive ones,
e.g. just allowing anything after hostname and capturing part of URL as id.
If some of these extractors happen to have an video embed of some different hoster or platform
and this scenario was not handled in extractor itself we end up with inability to download this embed
until extractor is fixed to support embed of this kind.
Forcing downloader to use the generic extractor can be a neat temporary solution for this problem.
Example: FiveTV extractor with Tvigle embed - http://www.5-tv.ru/rabota/broadcasts/48/