Closed louisabraham closed 1 year ago
The root cause is that when mpsyt
trying to parse video published date string, the employed function datetime.datetime.strptime()
did not recognize the ending Z
, which is time zone designator, in date string. (defined by ISO 8601 according to YouTube Data API v3)
In function commands.misc.video_info()
(or commands.misc.info()
in older version), we can simply add Z
in the format string to avoid this error, but I think we need more graceful way to handle this issue.
elif g.browse_mode == "normal":
g.content = logo(c.b)
screen.update()
screen.writestatus("Fetching video metadata..")
item = (g.model[int(num) - 1])
streams.get(item)
p = util.get_pafy(item)
- pub = datetime.strptime(str(p.published), "%Y-%m-%d %H:%M:%S")
+ pub = datetime.strptime(str(p.published), "%Y-%m-%d %H:%M:%SZ")
pub = util.utc2local(pub)
screen.writestatus("Fetched")
out = c.ul + "Video Info" + c.w + "\n\n"
I think it's ok to put a condition to test if the last character is Z (in case the API drops it). What do you imagine could be more graceful?
Issue
When trying to display information about a search result with
i 1
, I get the following error:Your Environment
I installed mpsyt from the github repository.