Help keeping session alive for stream scraper?
#1
Hello,

I am developing a stream scraper that requires you to be authenticated to the site.

By using urllib2+CookieJar I have been able to login to the site and regex the unique stream urls.
However, when playing the stream it will say the session has expired.
On a computer, I must keep the site open when playing the stream or they will get disabled.


How can I persist being "logged-in" to the site while starting/playing the stream?


Thanks.
Reply
#2
Need more information. You need to figure out how they're keeping the session alive on the website. Once you've got that information, we can help with reproducing it in an addon
Reply
#3
I would suggest using a modified xbmc.Player() instance for playback of this kind of stream. In your own Player-Class you can do whatever you need to keep the stream url valid (like sending keep-alive pings).
Clone the official plugin/script add-on Repositories and search in the code of other Add-ons - some are doing similar stuff.
My GitHub. My Add-ons:
Image
Reply
#4
After further investigation, the problems appears to be that the stream URL is one-time use.

So for example, I extract the URL and play it in say, VLC, and everything is ok.
Stop the stream. Play it again, "Session Has Expired".

However in XBMC, it always just shows "Session Has Expired" which probably would mean that XBMC is accessing the link multiple times?
I tried going through the debug logs but it is unclear if it is checking the URL multiple times.

Anyone have any input on this?
Reply
#5
It should maintain one connection until the buffer is full. Once the buffer is full, it will break the connection and start a new one when there is more room in the buffer.

If say what's causing your problem is Xbmc checks the link immediately before playback to collect details about the file and decide which player to use. Unfortunately I don't know of any way around this.

One possibility would be to start downloading the file, then pass the local path you're saving the file to Xbmc for playback. You can playback while still downloading, but if you try to play past what's already downloaded, Xbmc will think it's the end of the file and terminate playback just as if it had finished the whole file.
Reply

Logout Mark Read Team Forum Stats Members Help
Help keeping session alive for stream scraper?0