jnsougata / aiotube

An Alternative to YouTube Public Data API v3
MIT License
68 stars 12 forks source link

Issue in the regex pattern in Video class #21

Open xdityagr opened 19 hours ago

xdityagr commented 19 hours ago

I used aiotube recently and continuously got Attribute Error for a valid youtube id "kyAV-pzQwzU", and on further investigation i found that there is a problem with the regex pattern that is being used, the pattern does not consider "-" (hyphens) in it's logic and only considers alphanumeric characters.

pattern = re.compile('.be/(.*?)$|=(.*?)$|^(\w{11})$') # noqa, Line 20, video.py as well as stream.py & any other file where this pattern is used.

the correct pattern should be, pattern = re.compile(r'.be/(.*?)$|=(.*?)$|^([\w\-]{11})$')

Hope this helps, would love to further support the development. Thank you, Aditya.

jnsougata commented 17 hours ago

Thanks @xdityagr for pointing it out. A quick PR is appreciated. TIA