cleanurl icon indicating copy to clipboard operation
cleanurl copied to clipboard

Fix '__canonical_youtube' - vid ID cant be lower()

Open Kariton opened this issue 2 years ago • 4 comments

The youtube links dont work when the video ID is in lower case.

https://youtu.be/71ssvumt1ys -> "This video isn't available anymore" https://youtu.be/71SsVUmT1ys -> Plays "Real"

Kariton avatar Oct 09 '23 14:10 Kariton

Hi, thanks for the PR. Could you change it to call lower only when respect_semantics == False? And possibly add a test to test_semantics which tests that the case remains unchagned.

xojoc avatar Oct 11 '23 10:10 xojoc

I will look into that. :)

Kariton avatar Oct 28 '23 03:10 Kariton

somehting is odd.

>>> r = cleanurl.cleanurl('https://www.youtube.com/watch?v=dsbA4XH2-3A', respect_semantics=True)
>>> r.url
'https://www.youtube.com/watch?v=dsbA4XH2-3A'
>>> r = cleanurl.cleanurl('https://www.youtube.com/watch?v=dsbA4XH2-3A', respect_semantics=False)
>>> r.url
'https://youtube.com/watch?v=dsbA4XH2-3A'
>>> r = cleanurl.cleanurl('https://www.youtube.com/watch?v=71SsVUmT1ys&ignore=query', respect_semantics=False)
>>> r.url
'https://youtube.com/watch?ignore=query&v=71SsVUmT1ys'
>>> r = cleanurl.cleanurl('https://www.youtube.com/watch?v=71SsVUmT1ys&ignore=query', respect_semantics=True)
>>> r.url
'https://www.youtube.com/watch?ignore=query&v=71SsVUmT1ys'

while im pretty sure that the code should work... it does not. maybe my env is broken. ill investigate this further / later.

Kariton avatar Jun 03 '24 10:06 Kariton

what an oversight...

>>> import cleanurl
>>> r = cleanurl.cleanurl('https://www.youtube.com/watch?v=71SsVUmT1ys&ignore=query', respect_semantics=True)
>>> r.url
'https://youtu.be/71SsVUmT1ys'
>>> r = cleanurl.cleanurl('https://www.youtube.com/watch?v=71SsVUmT1ys&ignore=query', respect_semantics=False)
>>> r.url
'https://youtu.be/71ssvumt1ys'

Kariton avatar Jun 03 '24 10:06 Kariton