# Python click player to get src URL

**URL:** <https://forums.plex.tv/t/python-click-player-to-get-src-url/155274>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [August 21, 2016, 3:54am UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274 "2016-08-21T03:54:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![fluxcapa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/fluxcapa/32/20351_2.png) [@fluxcapa](https://forums.plex.tv/u/fluxcapa)\
**Post date:** [August 21, 2016, 3:54am UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274/1 "2016-08-21T03:54:01Z")

</div>

Hi all.

I’m trying to get a src for a video so it can play fullscreen through a channel.  
But the player requires the visitor to click the play button before a appears with a authenticated src=""

Any way of mimicking the click so after the src can be opened?

Thanks!

---

<div class="post-metadata">

**Author:** ![Twoure](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/twoure/32/91016_2.png) [@Twoure](https://forums.plex.tv/u/Twoure)\
**Post date:** [August 21, 2016, 4:21am UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274/2 "2016-08-21T04:21:42Z")

</div>

> @ideaprison said:  
> …the player requires the visitor to click the play button before a appears with a authenticated src=“”  
> Any way of mimicking the click so after the src can be opened?

No.

There are things such as [Selenium](http://selenium-python.readthedocs.io/) but require opening a real web browser and automating the clicks. This is not feasible within a Plex channel.

Instead, try monitoring the sites traffic to see what calls are being made to construct the final video URL. If you cannot see where the video URL comes from within the site traffic, then you’ll have to trace the JavaScript function back to its source and figure out how the URL is being constructed.

A few tricks:

1. Sometimes video host have easier to find streams from their mobile sites. Try setting the headers to a mobile platform to access it’s mobile site.
2. Some video host offer an embed page, which can have easier to find video links
3. [Google Chrome Developer Tools](https://developer.chrome.com/devtools) are a way to monitor site traffic and view resources (as-well-as many other useful tools). They are included by default.

If you’re willing to share the site _(and a video link if need be)_, then I can take a look for you.

---

<div class="post-metadata">

**Author:** ![fluxcapa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/fluxcapa/32/20351_2.png) [@fluxcapa](https://forums.plex.tv/u/fluxcapa)\
**Post date:** [August 21, 2016, 5:02am UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274/3 "2016-08-21T05:02:41Z")

</div>

Good tips. The site in questions is a local news site.

[http://khon2.com/live-stream/](http://khon2.com/live-stream/)

They use [livestream.com](http://livestream.com) embedded.  
Their player is only visible when viewed (here at least) in Safari (maybe Chrome too), you get the HTML5 player. Instead of their flash player.

‘a.play\_btn.js-play\_button’ could be clicked through JS but I assume the plex channel can’t do that for me.

---

<div class="post-metadata">

**Author:** ![Twoure](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/twoure/32/91016_2.png) [@Twoure](https://forums.plex.tv/u/Twoure)\
**Post date:** [August 21, 2016, 6:33am UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274/4 "2016-08-21T06:33:46Z")

</div>

> @ideaprison said:  
> [Hawaii Breaking News, Live Video - Live News](http://khon2.com/live-stream/)
> 
> They use [livestream.com](http://livestream.com) embedded.

After digging around livestream I did find the streaming URLs. Didn’t take time to figure out how to generate the correct keys to add with the URLs to make them play, because they will play with the [Livestreamer.bundle](https://github.com/coryo/Livestreamer.bundle) created by @“coryo123”.

The channel was hanging up on unsupported resolutions, so I did a quick edit and added your Khon2 URL.  
My Fork: [GitHub - Twoure/Livestreamer.bundle at khon2](https://github.com/Twoure/Livestreamer.bundle/tree/khon2)

Hope this is sufficient.

**Edit:** switched branches

---

<div class="post-metadata">

**Author:** ![fluxcapa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/fluxcapa/32/20351_2.png) [@fluxcapa](https://forums.plex.tv/u/fluxcapa)\
**Post date:** [August 21, 2016, 8:22am UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274/5 "2016-08-21T08:22:54Z")

</div>

I installed your branch version. I get the quality options showing, but when I try to play a video it says “Couldn’t create the playback session for this item”

---

<div class="post-metadata">

**Author:** ![Twoure](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/twoure/32/91016_2.png) [@Twoure](https://forums.plex.tv/u/Twoure)\
**Post date:** [August 21, 2016, 8:49am UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274/6 "2016-08-21T08:49:21Z")

</div>

> @ideaprison said:  
> I installed your branch version. I get the quality options showing, but when I try to play a video it says “Couldn’t create the playback session for this item”

Depending on how it was installed, the Service Code may not of registered. Try restarting PMS.

---

<div class="post-metadata">

**Author:** ![fluxcapa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/fluxcapa/32/20351_2.png) [@fluxcapa](https://forums.plex.tv/u/fluxcapa)\
**Post date:** [August 21, 2016, 7:11pm UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274/7 "2016-08-21T19:11:29Z")

</div>

That was it Twoure. Thanks a lot for this!

---

<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:** [January 8, 2020, 7:59pm UTC](https://forums.plex.tv/t/python-click-player-to-get-src-url/155274/8 "2020-01-08T19:59:14Z")

</div>


