configuration/local/bin/ytsearch

11 lines
351 B
Plaintext
Raw Normal View History

2021-01-23 22:44:30 +01:00
#!/usr/bin/env python
from youtube_search import YoutubeSearch # pip install youtube-search
from sys import argv
2024-08-02 11:37:09 +02:00
for result in reversed(YoutubeSearch(' '.join(argv[1:])).to_dict()):
2021-01-23 22:44:30 +01:00
print(result['duration'],
2024-08-02 11:37:09 +02:00
f"https://www.youtube.com{result['url_suffix'].split('&')[0]}",
2021-01-23 22:44:30 +01:00
f"{result['title']} -- {result['channel']}",
sep='\t')