mps-youtube / yewtube

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
GNU General Public License v3.0
8.09k stars 644 forks source link

Unable to search playlist #1159

Closed Mohanbarman closed 1 year ago

Mohanbarman commented 3 years ago

When I type // followed by a search query mpyst throws an exception.

Issue / Suggestion

(most recent call last): File "/usr/lib/python3.9/site-packages/mps_youtube/main.py", line 65, in matchfunction func(*matches) File "/usr/lib/python3.9/site-packages/mps_youtube/commands/search.py", line 386, in pl_search g.content = content.generate_playlist_display() File "/usr/lib/python3.9/site-packages/mps_youtube/content.py", line 155, in generate_playlist_display updated = yt_datetime(x.get('updated'))[1] File "/usr/lib/python3.9/site-packages/mps_youtube/util.py", line 315, in yt_datetime time_obj = time.strptime(yt_date_time, "%Y-%m-%dT%H:%M:%S.%fZ") File "/usr/lib/python3.9/_strptime.py", line 562, in _strptime_time tt = _strptime(data_string, format)[0] File "/usr/lib/python3.9/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '2020-09-19T04:41:27Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/mpsyt", line 33, in sys.exit(load_entry_point('mps-youtube==0.2.8', 'console_scripts', 'mpsyt')()) File "/usr/lib/python3.9/site-packages/mps_youtube/main.py", line 148, in main if matchfunction(i.function, i.regex, userinput): File "/usr/lib/python3.9/site-packages/mps_youtube/main.py", line 80, in matchfunction content.generate_songlist_display(zeromsg=g.message) File "/usr/lib/python3.9/site-packages/mps_youtube/content.py", line 74, in generate_songlist_display return generate_playlist_display() File "/usr/lib/python3.9/site-packages/mps_youtube/content.py", line 155, in generate_playlist_display updated = yt_datetime(x.get('updated'))[1] File "/usr/lib/python3.9/site-packages/mps_youtube/util.py", line 315, in yt_datetime time_obj = time.strptime(yt_date_time, "%Y-%m-%dT%H:%M:%S.%fZ") File "/usr/lib/python3.9/_strptime.py", line 562, in _strptime_time tt = _strptime(data_string, format)[0] File "/usr/lib/python3.9/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '2020-09-19T04:41:27Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'

Your Environment

OS : Arch python version : 3.9.2 mysyt version : 0.2.8 youtube-dl version : 2021.03.25

neos1lver commented 3 years ago

having the same problem with Arch :(

rasdehya commented 3 years ago

same on Debian 10 with python 3.7 and youtube-dl 2021.06.06

edit: sed s/\.Z\"\)/\Z\"\)/ utils.py make it for me by removing the dot after the seconds in 'time data'.

nikisix commented 3 years ago

@rasdehya almost worked.

Here's the patch that got me there:

315c315
<     time_obj = time.strptime(yt_date_time, "%Y-%m-%dT%H:%M:%S.%fZ")
---
>     time_obj = time.strptime(yt_date_time, "%Y-%m-%dT%H:%M:%SZ")
325c325
<     datetime_obj = datetime.strptime(yt_date_time, "%Y-%m-%dT%H:%M:%S.%fZ")
---
>     datetime_obj = datetime.strptime(yt_date_time, "%Y-%m-%dT%H:%M:%SZ")