Thanks for reporting the issue. "youtube-dl" is used by the Pafy and the code dependency is now migrated from the "Pafy" package to "Pytube".
However, the previous code with Pafy was not showing any error at my end.
Hope, the new code update will help.