cleanurl
cleanurl copied to clipboard
Fix '__canonical_youtube' - vid ID cant be lower()
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"
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.
I will look into that. :)
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.
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'