woefe / ytcc Goto Github PK
View Code? Open in Web Editor NEWCommand line tool to keep track of your favorite playlists on YouTube and many other places.
License: GNU General Public License v3.0
Command line tool to keep track of your favorite playlists on YouTube and many other places.
License: GNU General Public License v3.0
I often only have time to watch a short video, but you only see the duration after starting one. Thus i often have to cancel videos until i find a short one.
Would it be possible to add a duration column, so one could see the time needed right away?
Sometimes a video that is still part of a playlist has been taken down. When searching the playlists for new videos, errors will be shown for unavailable videos. Ytcc should ignore unavailable videos after a few failed attempts.
Is your feature request related to a problem? Please describe.
In v1, there was the handy -f
switch that allowed for filtering the channels in the TUI.
Describe the solution you'd like
It would be good if this, or something similar were to be reimplemented in v2. It would also be good to be able to filter by tag.
Describe alternatives you've considered
It's possible that it could instead be applied within the TUI, but this doesn't match the v1 feature. This would be a nice addition, but not a replacement in my opinion.
Additional context
My use case for this is that I have a couple of different aliases (for v1) that look like this: ytcc -f <lots of channels>
.
There are many channels I subscribe to that include subtopics or video series that I am not interested in.
It would be very useful to be able to add a filter to a subscribed channel in order to "include only" or "exclude all" videos matching a particular filter.
A real world example:
https://www.youtube.com/c/digikey/videos
Digikeys channel has a great series called Maker Update. I would love to be able to add this to ytcc but WITH a filter "Maker Update". Or lets say, exclude a batch of videos with "New Product" or "live" in their title.
Something that would be a partial step in that direction may be to filter/download videos by playlist. In the example above this wouldn't work because the Maker Update videos are not in a separate playlist. Additionally it would required the videos you are interested in be put into a playlist by the content creator regularly and/or consistently. (and this doesn't always happen) The ability to add a channel to ytcc but, limit it to a particular playlist would be extremely useful.
Thank you for such a handy program. I greatly appreciate it! If there is anything I can add to this (in terms of details etc) please let me know.
Feature request:
It would be nice to remove more than one channel per command while still making use of the auto completion.
This is helpful after importing your youtube subscriptions.
While following the migration instructions to migrate using the migration script, it fails...
The install using pip throws some errors but appears to function over all...
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting git+https://github.com/woefe/ytcc.git
Cloning https://github.com/woefe/ytcc.git to /tmp/pip-req-build-y2z0ogcc
Requirement already satisfied: click in /usr/lib/python3/dist-packages (from ytcc==2.0.1) (7.0)
Collecting wcwidth (from ytcc==2.0.1)
Downloading https://files.pythonhosted.org/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whl
Requirement already satisfied: youtube_dl in /usr/local/lib/python3.7/dist-packages (from ytcc==2.0.1) (2020.12.12)
Building wheels for collected packages: ytcc
Running setup.py bdist_wheel for ytcc ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-y2z0ogcc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-aioub81k --python-tag cp37:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
Failed building wheel for ytcc
Running setup.py clean for ytcc
Failed to build ytcc
Installing collected packages: wcwidth, ytcc
Found existing installation: ytcc 1.8.4
Uninstalling ytcc-1.8.4:
Successfully uninstalled ytcc-1.8.4
Running setup.py install for ytcc ... done
Successfully installed wcwidth-0.2.5 ytcc-2.0.1
Version appears to have been updated properly...
[pete@omv: src]$ ytcc --version
ytcc, version 2.0.1
Copyright (C) 2015-2020 Wolfgang Popp
This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU General
Public Licence for details.
The migrate.py script is then run using...
python3 migrate.py --olddb ~/.local/share/ytcc/ytcc.db.v1 --newdb ~/.local/share/ytcc/ytcc.d
This also appears to complete successfully without any errors. However, when I go to run ytcc and list subscriptions... I get this...
[pete@omv: src]$ ytcc subscriptions
ERROR: This version of ytcc is not compatible with the older database versions. See https://github.com/woefe/ytcc/blob/master/doc/migrate.md for more details.
Environment, configuration and version information
[pete@omv: src]$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
[pete@omv: src]$ uname -a
Linux omv.zhome 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l GNU/Linux
Bug report output
ytcc bug-report
---ytcc version---
2.0.1
---youtube-dl version---
2020.12.12
---SQLite version---
SQLite system library version: 3.27.2
Python module version: 2.6.0
---python version---
3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0]
---mpv version---
mpv 0.29.1 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
built on UNKNOWN
ffmpeg library versions:
libavutil 56.14.100 (runtime 56.22.100)
libavcodec 58.18.100 (runtime 58.35.100)
libavformat 58.12.100 (runtime 58.20.100)
libswscale 5.1.100 (runtime 5.3.100)
libavfilter 7.16.100 (runtime 7.40.101)
libswresample 3.1.100 (runtime 3.3.100)
ffmpeg version: 4.1.6-1~deb10u1+rpt1
---config dump---
[ytcc]
download_dir = ~/Downloads
mpv_flags = --really-quiet --ytdl --ytdl-format=bestvideo[height<=?1080]+bestaudio/best
order_by = playlists:asc, publish_date:desc
video_attrs = id, title, publish_date, duration, playlists
playlist_attrs = name, url, tags
db_path = ~/.local/share/ytcc/ytcc.db
date_format = %Y-%m-%d
max_update_fail = 5
max_update_backlog = 20
age_limit = 0
[tui]
alphabet = sdfervghnuiojkl
default_action = play_video
[theme]
prompt_download_audio = 2
prompt_download_video = 4
prompt_play_audio = 2
prompt_play_video = 4
prompt_mark_watched = 1
table_alternate_background = 245
[youtube_dl]
format = bestvideo[height<=?1080]+bestaudio/best
output_template = %(title)s.%(ext)s
ratelimit = 0
retries = 0
subtitles = off
thumbnail = true
skip_live_stream = true
merge_output_format = mkv
Migrating the entire v1 database schema is probably too much effort. Instead, it might be enough to export subscriptions with v1 and import the OPML export in v2. Problems with this first alternative:
Second alternative: A python script (preferably without dependencies) that renames the v1 db, exports subscriptions, and re-imports them with v2. This would solve the problems of the first alternative, but is more work.
I'd love to see everyone's thoughts on this.
Update README.md for version 2
I have tried this with several different channels, but I cannot subscribe to any channels. I have also tried with and without www.
$ ytcc -a "Jordan go to sleep" https://youtube.com/channel/UCJcK_CBW0M6TwtpUl99psxg
'https://youtube.com/channel/UCJcK_CBW0M6TwtpUl99psxg' is not a valid YouTube URL
I think it's failing here or here.
Bug report info:
$ ytcc --bug-report-info
mpv 0.32.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
built on UNKNOWN
ffmpeg library versions:
libavutil 56.31.100
libavcodec 58.54.100
libavformat 58.29.100
libswscale 5.5.100
libavfilter 7.57.100
libswresample 3.5.100
ffmpeg version: 4.2.3
---ytcc version---
1.8.3
---youtube-dl version---
2020.06.16.1
---SQLAlchemy version---
1.3.11
---feedparser version---
5.2.1
---lxml version---
4.5.1
---python version---
3.7.8 (default, Jul 6 2020, 10:47:30)
[GCC 9.3.0]
---mpv version---
---config dump---
[YTCC]
dbpath = ~/.local/share/ytcc/ytcc.db
downloaddir = [redacted]
mpvflags = --ytdl --ytdl-format=bestvideo[height<=?1080]+bestaudio/best
alphabet = sdfervghnuiojkl
orderby = date:desc,channel
defaultaction = play_video
subtitles = en
thumbnail = on
skiplivestream = yes
[color]
promptdownloadaudio = 2
promptdownloadvideo = 4
promptplayaudio = 2
promptplayvideo = 4
promptmarkwatched = 1
tablealternatebackground = 24
[youtube-dl]
format = bestvideo[height<=?1080]+bestaudio/best
outputtemplate = %(title)s.%(ext)s
loglevel = normal
ratelimit = 0
retries = 0
subtitles = off
thumbnail = on
skiplivestream = yes
mergeoutputformat = mkv
[TableFormat]
id = on
date = on
channel = on
title = on
url = off
watched = on
Since yesterday (2020-11-09) updating doesn’t add new videos despite multiple of my subscriptions published new videos since.
Ytcc version 2 shows the publish date of a video by default. The date format should be adjustable. The default should be YYYY-MM-DD
.
This is a bit trivial but it would be nice if urlopen
had a popular user-agent like windows 10 chrome or something
The SQL query for the cleanup command still assumes the old schema and therefore crashes.
It would be nice if the order of columns in V2 would reflect the order of this config option like in the old version:
Default:
video_attrs = id, title, publish_date, duration, playlists
Alternative order that i like:
video_attrs = playlists, title, duration, publish_date
Recently started having a problem running ytcc on NixOS Unstable, here's the error:
nixos-workstation% ytcc
Updating channels...
Traceback (most recent call last):
File "/nix/store/7cvik4jvdj7h1wm049ssh157616yirip-python3.8-feedparser-5.2.1/lib/python3.8/site-packages/feedparser.py", line 398, in __getattr__
return self.__getitem__(key)
File "/nix/store/7cvik4jvdj7h1wm049ssh157616yirip-python3.8-feedparser-5.2.1/lib/python3.8/site-packages/feedparser.py", line 356, in __getitem__
return dict.__getitem__(self, key)
KeyError: 'published_parsed'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/bin/.ytcc-wrapped", line 5, in <module>
main()
File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/cli.py", line 617, in main
run()
File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/cli.py", line 596, in run
update_all()
File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/cli.py", line 384, in update_all
ytcc_core.update_all()
File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/core.py", line 161, in update_all
self.database.add_videos(videos)
File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/database.py", line 121, in add_videos
for video in videos:
File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator
yield fs.pop().result()
File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/nix/store/fjgnz0xfl04hsblsi4ym5y5akfh6mlmy-python3-3.8.5/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/core.py", line 140, in _update_channel
return [
File "/nix/store/z02820cl28g848y3w5j310dy42g5mhss-ytcc-1.8.4/lib/python3.8/site-packages/ytcc/core.py", line 146, in <listcomp>
publish_date=time.mktime(entry.published_parsed),
File "/nix/store/7cvik4jvdj7h1wm049ssh157616yirip-python3.8-feedparser-5.2.1/lib/python3.8/site-packages/feedparser.py", line 400, in __getattr__
raise AttributeError("object has no attribute '%s'" % key)
AttributeError: object has no attribute 'published_parsed'
nixos-workstation% ytcc -v
ytcc version 1.8.4
Copyright (C) 2015-2019 Wolfgang Popp
This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU General
Public Licence for details.
nixos-workstation% uname -a
Linux nixos-workstation 5.7.16 #1-NixOS SMP Wed Aug 19 06:24:20 UTC 2020 x86_64 GNU/Linux
Is your feature request related to a problem? Please describe.
When playing a video by mistake, it is mark as watched, even when exiting mpv after a few seconds.
Describe the solution you'd like
Add a feature to mark video as not watched
Additional context
In TUI, recently watched video can still be listed, with a different markup, to be able to unwatch them.
It can be also a good thing to monitor elapsed time in player, and ask the user if the video should be marked as watched whenever there is not enough elapsed time (half? 80%?).
Tried to watch my youtube subscriptions but recieved an error instead...
$ ytcc
Updating channels...
Traceback (most recent call last):
File "/usr/bin/ytcc", line 4, in <module>
main()
File "/usr/lib/python3.6/site-packages/ytcc/cli.py", line 537, in main
parse_args()
File "/usr/lib/python3.6/site-packages/ytcc/cli.py", line 521, in parse_args
list_videos()
File "/usr/lib/python3.6/site-packages/ytcc/cli.py", line 220, in list_videos
print_videos(videos)
File "/usr/lib/python3.6/site-packages/ytcc/cli.py", line 202, in print_videos
table_print(row_filter(table_header), table)
File "/usr/lib/python3.6/site-packages/ytcc/cli.py", line 184, in table_print
print(table_format.format(*header))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2502' in position 6: ordinal not in range(128)
I'm guessing this is because one of the video titles simply has an unusual unicode character.
Thanks for making ytcc, I use it every day.
Fix f-keys in tui module
If you switch to a different view mode in the tui, you have to hit Ctrl+d twice to exit.
I don’t know python, but in bash you would catch the ^D and execute an exit function.
Is your feature request related to a problem? Please describe.
Unable to use the same custom 'name' (ytcc rename) defined in ytcc as youtube_dl output.
Describe the solution you'd like
Would be great to allow the name we define in ytcc to be used as an output in the youtube_dl format option. For example instead of using something like this:
[youtube_dl]
output_template = %(uploader)s/%(title)s.%(ext)s
We can use this:
[youtube_dl]
output_template = %(ytcc_name)s/%(title)s.%(ext)s
Additional context
Would be nice to have a youtube_dl flags options the same as mpv does. Some youtubers have crazy titles (emojii's etc) so being able to pass in --restrict-filenames
would be nice.
I just tried migrating to v2 but i was unable to add subscriptions.
First i tried migrating via "Channel export and import". It displayed a bunch of infos about channels being added but "ytcc subscriptions" or "ytcc tui" stayed empty.
I then reset everything by deleting the config and database and tried adding a channel normally (ytcc subscribe). But that didn’t work either.
This was done using the ytcc-git from aur with commit d4d7199
Some youtube channels put up placeholders for future live videos. When such videos are encountered, ytcc fails to download them with:
ERROR: This video is unavailable.
An Error occured while downloading the video
After which ytcc hard exits. Resulting in preceding videos not being marked as downloaded and locking up the download queue until the offending video is manually marked as watched.
This obviously breaks cron :p
Add help text to click decorators
Updating returns the following:
$ ytcc
Updating channels...
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib64/python3.5/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/lib64/python3.5/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/usr/lib/python3.5/site-packages/ytcc-1.5.1-py3.5.egg/ytcc/core.py", line 205, in _update_channel
feed = feedparser.parse("https://www.youtube.com/feeds/videos.xml?channel_id=" + yt_channel_id)
File "/usr/lib/python3.5/site-packages/feedparser.py", line 3957, in parse
saxparser.parse(source)
File "/usr/lib64/python3.5/site-packages/drv_libxml2.py", line 189, in parse
eltName = (_d(reader.NamespaceUri()),\
File "/usr/lib64/python3.5/site-packages/drv_libxml2.py", line 70, in _d
return _decoder(s)[0]
File "/usr/lib64/python3.5/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
TypeError: a bytes-like object is required, not 'str'
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/ytcc", line 4, in <module>
__import__('pkg_resources').run_script('ytcc==1.5.1', 'ytcc')
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 724, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1657, in run_script
exec(script_code, namespace, namespace)
File "/usr/lib/python3.5/site-packages/ytcc-1.5.1-py3.5.egg/EGG-INFO/scripts/ytcc", line 4, in <module>
__import__('pkg_resources').run_script('ytcc==1.5.1', 'ytcc')
File "/usr/lib/python3.5/site-packages/ytcc-1.5.1-py3.5.egg/ytcc/cli.py", line 510, in main
File "/usr/lib/python3.5/site-packages/ytcc-1.5.1-py3.5.egg/ytcc/cli.py", line 493, in parse_args
File "/usr/lib/python3.5/site-packages/ytcc-1.5.1-py3.5.egg/ytcc/cli.py", line 40, in update_all
File "/usr/lib/python3.5/site-packages/ytcc-1.5.1-py3.5.egg/ytcc/core.py", line 221, in update_all
File "/usr/lib64/python3.5/multiprocessing/pool.py", line 260, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/usr/lib64/python3.5/multiprocessing/pool.py", line 608, in get
raise self._value
TypeError: a bytes-like object is required, not 'str'
It appears to me that ytcc operates only on a Youtube 'Channel' basis (I may be wrong).. My question, Is there a way to limit ytcc results to a single 'Playlist' within a Channel?
For example, say Youtube channel 'X' posts many videos into numerous different playlists. Is there a way to limit ytcc to downloading only videos from within a single playlist rather than from all videos on the 'Videos' page of the given channel?
I have been able to do the same from CLI with youtube-dl, but seems to not be possible currently with ytcc. I would prefer to use ytcc as it seems much more efficient on network calls. Apologies for the naive question. Thanks!
adding any channel does not work any longer:
ytcc -a "Jupiter Broadcasting" https://www.youtube.com/user/jupiterbroadcasting is not a valid YouTube URL
ytcc --bug-report-info:
`---ytcc version---
1.8.3
---youtube-dl version---
2020.06.16.1
---SQLAlchemy version---
1.3.18
---feedparser version---
5.2.1
---lxml version---
4.5.2
---python version---
3.8.3 (default, May 17 2020, 18:15:42)
[GCC 10.1.0]
---mpv version---
mpv 0.32.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
built on UNKNOWN
ffmpeg library versions:
libavutil 56.31.100
libavcodec 58.54.100
libavformat 58.29.100
libswscale 5.5.100
libavfilter 7.57.100
libswresample 3.5.100
ffmpeg version: n4.2.3
---config dump---
[YTCC]
dbpath = ~/.local/share/ytcc/ytcc.db
downloaddir = ~/Downloads
mpvflags = --really-quiet --ytdl --ytdl-format=bestvideo[height<=?720]+bestaudio/best
alphabet = sdfervghnuiojkl
orderby = channel, date
defaultaction = play_video
[color]
promptdownloadaudio = 2
promptdownloadvideo = 4
promptplayaudio = 2
promptplayvideo = 4
promptmarkwatched = 1
tablealternatebackground = 245
[youtube-dl]
format = bestvideo[height<=?1080]+bestaudio/best
outputtemplate = %(title)s.%(ext)s
loglevel = normal
ratelimit = 0
retries = 0
subtitles = off
thumbnail = on
skiplivestream = yes
mergeoutputformat = mkv
[TableFormat]
id = on
date = off
channel = on
title = on
url = off
watched = off`
First, thank you for this awesome tool and great work on it! I truly appreciate it. If I can help debugging this issue or testing changes please let me know. (I'd be happy to do so)
The issue I have is that I would like ytcc to only pull videos that are 1920 x 1080 or higher in resolution and it sometimes works, sometimes pulls 640x480 or lower.
I have had my ytcc.conf file (located in /home/user/.config/ytcc.conf) set to, 1080, 1920, etc but cannot get this to function correctly or consistently.
From ytcc.conf file...
[youtube-dl]
format = mkv/mp4/bestvideo[height>=1920]+bestaudio/best
Attached is a bug-report-info file.
I would also like to know if you would be interested in a proper man page for this utility. I would gladly assist in its creation and submission to this project.
Thank you.
Pete
Describe the bug
If a playlist/subscription has multiple videos uploaded on the same day, they are not sorted by time when using the publish_date
ordering.
To Reproduce
Subscribe to a channel that publishes multiple videos per day and update.
Set the order_by
value in ytcc.conf
to publish_date:asc
.
Execute ytcc list -p <channel>
Expected behavior
Videos are listed in the strict order they were published.
Environment, configuration and version information
---ytcc version---
2.0.1
---youtube-dl version---
2020.12.09
---SQLite version---
SQLite system library version: 3.34.0
Python module version: 2.6.0
---python version---
3.9.0 (default, Dec 6 2020, 18:02:34)
[Clang 12.0.0 (clang-1200.0.32.27)]
---mpv version---
mpv 0.33.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
built on Sun Nov 22 19:54:23 GMT 2020
FFmpeg library versions:
libavutil 56.51.100
libavcodec 58.91.100
libavformat 58.45.100
libswscale 5.7.100
libavfilter 7.85.100
libswresample 3.7.100
FFmpeg version: 4.3.1
---config dump---
[ytcc]
download_dir = ~/Downloads
mpv_flags = --really-quiet --ytdl --ytdl-format=bestvideo[height<=?1080]+bestaudio/best
order_by = publish_date:asc
video_attrs = id, title, publish_date, duration, playlists
playlist_attrs = name, url, tags
db_path = ~/.local/share/ytcc/ytcc.db
date_format = %Y-%m-%d
max_update_fail = 5
max_update_backlog = 20
age_limit = 0
[tui]
alphabet = sdfervghnuiojkl
default_action = play_video
[theme]
prompt_download_audio = 2
prompt_download_video = 4
prompt_play_audio = 2
prompt_play_video = 4
prompt_mark_watched = 1
table_alternate_background = 19
[youtube_dl]
format = bestvideo[height<=?1080]+bestaudio/best
output_template = %(title)s.%(ext)s
ratelimit = 0
retries = 0
subtitles = off
thumbnail = true
skip_live_stream = true
merge_output_format = mkv
Additional context
Example output from a channel below. I used the YouTube Data API to retrieve two of the videos (Part 225 and 224). 224's publishedAt property was one hour before 225, but in the list below all the videos for each day are sorted in descending order by time even though the ordering in the config file is publish_date:asc
.
id │ title │ publish_date │ duration │ playlists
──────┼───────────────────────────────────────────────────────────────────┼──────────────┼──────────┼───────────────────
56 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 202 │ 2020-11-24 │ 32:21 │ Aavak After Hours
57 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 201 │ 2020-11-24 │ 34:11 │ Aavak After Hours
58 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 200 │ 2020-11-24 │ 32:04 │ Aavak After Hours
59 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 199 │ 2020-11-24 │ 31:35 │ Aavak After Hours
60 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 198 │ 2020-11-24 │ 30:15 │ Aavak After Hours
49 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 209 │ 2020-11-25 │ 29:11 │ Aavak After Hours
50 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 208 │ 2020-11-25 │ 29:14 │ Aavak After Hours
51 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 207 │ 2020-11-25 │ 31:01 │ Aavak After Hours
52 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 206 │ 2020-11-25 │ 35:05 │ Aavak After Hours
53 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 205 │ 2020-11-25 │ 28:30 │ Aavak After Hours
54 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 204 │ 2020-11-25 │ 31:08 │ Aavak After Hours
55 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 203 │ 2020-11-25 │ 30:21 │ Aavak After Hours
41 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 217 │ 2020-12-03 │ 31:41 │ Aavak After Hours
42 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 216 │ 2020-12-03 │ 36:35 │ Aavak After Hours
43 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 215 │ 2020-12-03 │ 32:30 │ Aavak After Hours
44 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 214 │ 2020-12-03 │ 32:47 │ Aavak After Hours
45 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 213 │ 2020-12-03 │ 29:07 │ Aavak After Hours
46 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 212 │ 2020-12-03 │ 31:52 │ Aavak After Hours
47 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 211 │ 2020-12-03 │ 31:05 │ Aavak After Hours
48 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 210 │ 2020-12-03 │ 25:10 │ Aavak After Hours
2451 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 225 │ 2020-12-09 │ 40:52 │ Aavak After Hours
2452 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 224 │ 2020-12-09 │ 32:56 │ Aavak After Hours
2453 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 223 │ 2020-12-09 │ 32:24 │ Aavak After Hours
2454 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 222 │ 2020-12-09 │ 33:54 │ Aavak After Hours
2455 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 221 │ 2020-12-09 │ 30:13 │ Aavak After Hours
2456 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 220 │ 2020-12-09 │ 30:04 │ Aavak After Hours
2457 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 219 │ 2020-12-09 │ 31:27 │ Aavak After Hours
2458 │ Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 218 │ 2020-12-09 │ 32:34 │ Aavak After Hours
Partial responses for each video from the API:
{
"kind": "youtube#videoListResponse",
"etag": "xTwOH37rQ4erFVC3YQJ2CpE6SWw",
"items": [
{
"kind": "youtube#video",
"etag": "PXp1Up0QqBrdbhND8bSr8y6P5wc",
"id": "OGUUo5V0CuQ",
"snippet": {
"publishedAt": "2020-12-10T04:00:02Z",
"channelId": "UCk7U8vOfzutkuZ-coGdpXrw",
"title": "Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 224",
{
"kind": "youtube#videoListResponse",
"etag": "zD1fJud1ccfJIQQm_SUjtzzuD9I",
"items": [
{
"kind": "youtube#video",
"etag": "BEj4UbeWNkTdXVe3hnzt9N7Nsuw",
"id": "WQj-OJ6Pwqs",
"snippet": {
"publishedAt": "2020-12-10T05:00:21Z",
"channelId": "UCk7U8vOfzutkuZ-coGdpXrw",
"title": "Oxygen Not Included: Oassise – Let’s Play Stream Archive Part 225",
Describe the bug
Archlinux updated today some python library, since then ytcc is broken
To Reproduce
any ytcc command fails with:
Traceback (most recent call last):
File "/usr/bin/ytcc", line 33, in
sys.exit(load_entry_point('ytcc==2.0.1', 'console_scripts', 'ytcc')())
File "/usr/bin/ytcc", line 22, in importlib_load_entry_point
for entry_point in distribution(dist_name).entry_points
File "/usr/lib/python3.9/importlib/metadata.py", line 524, in distribution
return Distribution.from_name(distribution_name)
File "/usr/lib/python3.9/importlib/metadata.py", line 187, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: ytcc
Expected behavior
upgraded python-click (7.1.2-1 -> 7.1.2-3)
upgraded python-setuptools (1:50.3.2-1 -> 1:50.3.2-4)
upgraded python-wcwidth (0.2.5-1 -> 0.2.5-3)
downgrading the updated python library could not solve the issue:
downgraded python-wcwidth (0.2.5-3 -> 0.2.5-1)
downgraded python-click (7.1.2-3 -> 7.1.2-1)
downgraded python-setuptools (1:50.3.2-4 -> 1:50.3.2-1)
Environment, configuration and version information
LSB_VERSION=1.4
DISTRIB_ID=Arch
DISTRIB_RELEASE=rolling
DISTRIB_DESCRIPTION="Arch Linux"
Add the output of ytcc bug-report
here
ytcc bug-report
Traceback (most recent call last):
File "/usr/bin/ytcc", line 33, in <module>
sys.exit(load_entry_point('ytcc==2.0.1', 'console_scripts', 'ytcc')())
File "/usr/bin/ytcc", line 22, in importlib_load_entry_point
for entry_point in distribution(dist_name).entry_points
File "/usr/lib/python3.9/importlib/metadata.py", line 524, in distribution
return Distribution.from_name(distribution_name)
File "/usr/lib/python3.9/importlib/metadata.py", line 187, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: ytcc
Add fzf/rofi/dmenu scripts to showcase the new listing and piping feature. v2 is more unixy. In particular, the commands play
, mark
and download
can read IDs from stdin. Example:
./ytcc.py --output table list --attributes id,title,playlists,duration | fzf | awk -F '│' '{print $1}' | ./ytcc.py play
Hi Wolfgang
Thank you very much for ytcc.
This syntax does not work (but it used to work):
ytcc --path Path --download n --channel-filter channel
Whatever the Path value, the download starts in my default download directory (XFCE , ~/Downloads)
Ditto for the -p option
$ ytcc -v
ytcc version 1.4.0
Best wishes
Currently, the duration is shown in seconds. It should be in mm:ss
format instead. As most videos are probably shorter than an hour and likely not longer than a couple of hours, I prefer mm:ss
over hh:mm:ss
.
Translations for v2 should also use gettext as in v1. Translations should be updated and relevant strings should be translated
Sometimes I might want to watch a certain genre of YouTube subscriptions, like music, tech, news, or podcasts. It would be nice if we could categorize our subscription feeds so we could watch only what we're in the mood for.
When running ytcc -ud
and a current subscription is live streaming you get a repeating error and ytcc never exits. I think this is similar to #9.
In this example, I was trying to download the latest videos from the channel Jupiter Broadcasting while they were live streaming. The last line in the error would just repeat until the process was killed.
Edit: This might be an issue with youtube-dl?
Error output
[youtube] eU4NO_DWvs0: Downloading webpage
[youtube] eU4NO_DWvs0: Downloading video info webpage
[youtube] eU4NO_DWvs0: Downloading m3u8 information
[youtube] eU4NO_DWvs0: Downloading MPD manifest
[youtube] eU4NO_DWvs0: Downloading MPD manifest
[download] Destination: /data/videos/youtube/jblive.tv Year Review Holiday Stream 🍻.mp4
ffmpeg version n4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20180831
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[hls,applehttp @ 0x561ee0358040] Opening 'https://r4---sn-aigl6ney.googlevideo.com/videoplayback/id/eU4NO_DWvs0.0/itag/95/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D136/hls_chunk_host/r4---sn-aigl6ney.googlevideo.com/playlist_type/DVR/gcr/gb/ei/gG4nXMzFB83dxwKn0oGABQ/initcwndbps/19690/mm/32/mn/sn-aigl6ney/ms/lv/mv/m/pl/32/keepalive/yes/mt/1546087976/disable_polymer/true/ip/2a01:4b00:ea1a:4c00:9ec3:fc64:f8ee:a574/ipbits/0/expire/1546109665/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/6D0B12AE81C73511DF5CA55820F11E02EFE5D92F.897208F439995672DE862359287BEC44004CB829/key/dg_yt0/playlist/index.m3u8/sq/115064/goap/clen%3D48404%3Blmt%3D1545857920282089/govp/clen%3D42372%3Blmt%3D1545857920282091/dur/2.000/file/seg.ts' for reading
YT Channel: https://www.youtube.com/user/jupiterbroadcasting
Live stream URL (at the time): https://www.youtube.com/watch?v=eU4NO_DWvs0
bug-report-info
ytcc --bug-report-info
---ytcc version---
1.7.3
---youtube-dl version---
2018.12.17
---feedparser version---
5.2.1
---lxml version---
4.2.5
---dateutil version---
2.7.5
---python version---
3.7.1 (default, Oct 22 2018, 10:41:28)
[GCC 8.2.1 20180831]
---mpv version---
mpv 0.29.1 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
built on Sun Dec 9 16:21:27 CET 2018
ffmpeg library versions:
libavutil 56.22.100
libavcodec 58.35.100
libavformat 58.20.100
libswscale 5.3.100
libavfilter 7.40.101
libswresample 3.3.100
ffmpeg version: n4.1
---config dump---
[YTCC]
dbpath = ~/.local/share/ytcc/ytcc.db
downloaddir = /data/videos/youtube
mpvflags = --really-quiet --ytdl --ytdl-format=bestvideo[height<=?1080]+bestaudio/best
ytdloutputtemplate = %(title)s.%(ext)s
[youtube-dl]
format = bestvideo[height<=?1080]+bestaudio/best
outputtemplate = %(title)s.%(ext)s
loglevel = normal
ratelimit = 0
retries = 0
subtitles = off
thumbnail = on
[quickselect]
enabled = yes
ask = yes
alphabet = sdfervghnuiojkl
[TableFormat]
id = on
date = off
channel = on
title = on
url = off
watched = off
After trying to make outputtemplate field work, without success, I cloned the repo and realized that the expected value is output_template. I guess that merge_output_format at the beginning of [youtube_dl] section and mergeoutputformat a few lines after aren't intended too.
Steps to reproduce the behavior:
Changing any of these doesn’t have an effect with V2:
[theme]
prompt_download_audio = 2
prompt_download_video = 4
prompt_play_audio = 2
prompt_play_video = 4
prompt_mark_watched = 1
table_alternate_background = 245
v1 had an OPML import for Youtube subscriptions. That should be a thing in v2 again!
Is your feature request related to a problem? Please describe.
Long videos can't be watched in one time. Resuming them can be useful.
Describe the solution you'd like
When exiting player in the middle of a video, it could be nice to be able to save the timestamp, and use it when relaunching the video.
Additional context
We have to see if it can be solved along with #69
For 1 byte long characters, the tables look correct:
ASCII Title |
abcde |
The |
is at the same position.
But more complex UTF-8 characters mess up the space calculation:
ASCII Title |
Title with 😁 |
It seems, due to the emoji needing 2 bytes, but actually only displaying as one byte, the calculation for the spaces is wrong. The same applies to German umlauts and other scripts like Japanese.
I was wondering if you are considering supporting other video provider services, especially those who are not Orwellian like youtube. What I consider as innocent videos are getting pulled from Youtube even in the midst of being downloaded by ytcc. This has gone too far. If the excellent ytcc only supports youtube then
regretfully from now on I will not use it.
Bitchute would be an example of a popular alternative.
Best wishes
Version info:
ytcc --version
1.6.1
> youtube-dl --version
2018.07.29
> mpv --version
mpv 0.29.0 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
built on Sun Jul 22 21:06:23 CEST 2018
ffmpeg library versions:
libavutil 56.14.100
libavcodec 58.18.100
libavformat 58.12.100
libswscale 5.1.100
libavfilter 7.16.100
libswresample 3.1.100
ffmpeg version: n4.0.2
When downloading a video using ytcc
:
> ytcc
Updating channels...
[snip]
Play video "Video Name" by "Channel"?
[y(es)/n(o)/a(udio)/m(ark)/q(uit)/h(elp)] (Default: y): dv
[youtube] $video: Downloading webpage
[youtube] $video: Downloading video info webpage
[download] Destination: /path/$video.webm
The youtube-dl
config is being ignored. Output using plain youtube-dl
:
> youtube-dl $video
[debug] System config: []
[debug] User config: ['-f', 'mp4[height<=?1080]+bestaudio/best', '-v']
[debug] Custom config: []
[debug] Command-line args: ['$video']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.07.29
[debug] Python version 3.6.6 (CPython) - Linux-4.17.10-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg n4.0.2, ffprobe n4.0.2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] video: Downloading webpage
[youtube] video: Downloading video info webpage
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on '$really_long_url'
[download] Destination: /parth/$video.mp4
~/.config/youtube-dl/config
:
-f 'bestvideo[height<=?1080]+bestaudio/best'
-v
~/.config/ytcc/ytcc.conf
:
[YTCC]
dbpath = ~/.local/share/ytcc/ytcc.db
downloaddir = ~/Stuff/YouTube
mpvflags = --really-quiet --ytdl --ytdl-format=bestvideo[height<=?1080]+bestaudio/best
[TableFormat]
id = on
date = off
channel = on
title = on
url = off
watched = off
Is your feature request related to a problem? Please describe.
While we can skip livestreaming while live (fantastic) some youtubers now convert livestreams to videos after broadcast, these can last hours and be quite a sizable download (3G+).
Describe the solution you'd like
It looks like ytcc knows the duration of the video before downloading. Having an option to skip/mark videos longer than X duration in minutes would solve this.
[ytcc]
max_duration=120
Currently ytcc/V2 ignores videos "due to age limit".
As far as i know this was implemented because youtube changed the api and youtube-dl couldn’t download these videos anymore. But, it seems to work again! I checked some of the videos ytcc/V2 ignored and was able to download them with youtube-dl or play them with mpv.
So could you include these videos again?
In case youtube restricts these again, youtube-dl also has options to give your login credentials. An alternative option would be to launch age restricted videos in a browser instead of mpv.
I'm aware I can switch ytcc to audio only using -x, but I'd like if I could choose individually for each video.
So instead of:
Play video "Level1 News December 12 2017: Yo Dawg, I Heard you Like A.I." by "Level1Techs?" [y(es)/n(o)/m(ark)/q(uit)/h(elp)] (Default: y):
It would be:
Play video "Level1 News December 12 2017: Yo Dawg, I Heard you Like A.I." by "Level1Techs?" [y(es)/n(o)/m(ark)/a(udio)/q(uit)/h(elp)] (Default: y):
This way you could simply press 'a' for audio only.
Also I just noticed that the question mark at the end is inside the quotation marks which makes it look like it's part of the channel name.
Thanks woefe for your great work on ytcc, I use it every day.
Previously, channel URLs were in the form of
https://www.youtube.com/channel/...
That seems to have been changed to:
https://www.youtube.com/c/...
Adding a channel with the new URL doesn’t resolve the playlist.
The loglevel config option and the --verbose flag should actually do something useful. youtube-dl's logging should probably use a custom logger to provide better control of what is printed when looking for new videos.
Sometimes I have a terminal running ytcc in the background that I've forgotten about, and then I try to run another instance of ytcc and get a long complex error message. Perhaps instead ytcc should check that the database is locked and provide a user friendly message that another instance of ytcc may already be running.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.