# Convert an HTML encoded url?

**URL:** <https://forums.plex.tv/t/convert-an-html-encoded-url/45714>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [October 30, 2013, 1:33pm UTC](https://forums.plex.tv/t/convert-an-html-encoded-url/45714 "2013-10-30T13:33:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TehCrucible](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/tehcrucible/32/5777_2.png) [@TehCrucible](https://forums.plex.tv/u/TehCrucible)\
**Post date:** [October 30, 2013, 1:33pm UTC](https://forums.plex.tv/t/convert-an-html-encoded-url/45714/1 "2013-10-30T13:33:49Z")

</div>

Hey guys, me again. &nbsp;Quick question. &nbsp;So I'm working on a channel that pulls the video link from inside a flash player iframe. &nbsp;So far, my regex is working and I'm able to isolate the video link as a string. &nbsp;However the url is encoded like so:

```
http%3A%2F%2Fs23.videofun.me%2Fvideos%2FOne-Piece%2FOne-Piece-316.flv%3Fst%3D0lvvFIxQJyRZIM0JPBiVTw%26e%3D1383146128
```

and playback fails when trying to redirect based on that url. &nbsp;Logs show me a 302. &nbsp;I'm assuming it needs to look more like this:

```
http://s23.videofun.me/videos/One-Piece/One-Piece-316.flv?st=0lvvFIxQJyRZIM0JPBiVTw&e=1383146128
```

Is there a simple way to achieve this within the url service code? &nbsp;Am I doing something else wrong? &nbsp;My function is as follows:

```
def PlayVideo(url):

```
iframe_url = HTML.ElementFromURL(url).xpath("//div[@id='streams']//iframe/@src")[0]
page_data = HTML.ElementFromURL(iframe_url)
string_data = HTML.StringFromElement(page_data)

find_url = RE_PLAYLIST.search(string_data).group()	

return Redirect(find_url)

```
```

---

<div class="post-metadata">

**Author:** ![FredenFromSweden](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/fredenfromsweden/32/7934_2.png) [@FredenFromSweden](https://forums.plex.tv/u/FredenFromSweden)\
**Post date:** [October 30, 2013, 3:13pm UTC](https://forums.plex.tv/t/convert-an-html-encoded-url/45714/2 "2013-10-30T15:13:44Z")

</div>

```
String.Unquote(s, usePlus=False)
```

will convert the URL into the format you are looking for.

[http://dev.plexapp.com/docs/api/utilkit.html?highlight=string.unquote#String.Unquote](http://dev.plexapp.com/docs/api/utilkit.html?highlight=string.unquote#String.Unquote)

---

<div class="post-metadata">

**Author:** ![TehCrucible](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/tehcrucible/32/5777_2.png) [@TehCrucible](https://forums.plex.tv/u/TehCrucible)\
**Post date:** [October 30, 2013, 10:07pm UTC](https://forums.plex.tv/t/convert-an-html-encoded-url/45714/3 "2013-10-30T22:07:17Z")

</div>

Thank you, that did the trick. &nbsp;I had never noticed the Utilities page in the docs. :rolleyes:&nbsp;&nbsp;There's some useful stuff there.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 21, 2019, 12:21am UTC](https://forums.plex.tv/t/convert-an-html-encoded-url/45714/4 "2019-12-21T00:21:19Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
