0

When i extract a url, it displays as below

https://tv.line.me/v/14985624_%E0%B8%A0%E0%B8%B9%E0%B8%95%E0%B8%A3%E0%B8%B1%E0%B8%95%E0%B8%95%E0%B8%B4%E0%B8%81%E0%B8%B2%E0%B8%A5-ep3-6-6-%E0%B8%8A%E0%B9%88%E0%B8%AD%E0%B8%878

how do i convert this to more readable format like below in python. The link below is the same as above.

Link to the image of how the url appears on browser address bar

Yatish
  • 27
  • 1
  • 5
  • 1
    What do you mean by "more readable" ? Split at some n characters? See https://stackoverflow.com/questions/9475241/split-string-every-nth-character – Jan Jul 28 '20 at 05:43
  • i just updated my question with the image of the URL as it appears in the address bar. I want to convert the string extracted to that format – Yatish Jul 28 '20 at 05:49
  • Maybe they want to display the special characters? – whackamadoodle3000 Jul 28 '20 at 05:49
  • ya so when i extract the link, i think the THAI characters in the URL are converted into i think its ACSII equivalent. so i want to convert it back to its original form like shown in the image above – Yatish Jul 28 '20 at 05:52

1 Answers1

2

You can use urllib module to decode this url

from urllib.parse import unquote
url = unquote('https://tv.line.me/v/14985624_%E0%B8%A0%E0%B8%B9%E0%B8%95%E0%B8%A3%E0%B8%B1%E0%B8%95%E0%B8%95%E0%B8%B4%E0%B8%81%E0%B8%B2%E0%B8%A5-ep3-6-6-%E0%B8%8A%E0%B9%88%E0%B8%AD%E0%B8%878')

print(url)

This will give you the result as follows.

https://tv.line.me/v/14985624_ภูตรัตติกาล-ep3-6-6-ช่อง8

Thank you

Dinesh
  • 812
  • 4
  • 14