Thursday, December 27, 2012

WeepeeTV and VLC

Started testdriving WeepeeTV this week, bought a subscription for a month (for now).
You can watch tv (SD quality / H264 encoded) using flash (cpu intensive) or HLS.

Unfortunately there's no API available.

But with some creative screenscraping and parsing a lot of fun stuff can be done. 
One example below is a VLC plugin which uses my own xml file (created by screenscraping) as a source.
Very easy way to switch channels without clicking too much or using a browser.

I will put my xml creating script on github, so you can use it too :-)

To use this lua script put it in the lua/sd directory and call it weepeetv.lua
Ofcourse you need to change the parse_url to your own server or local file.

--SD_Description=WeePee TV
 Authors: 42wim

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.

require "simplexml"

function descriptor()
    return { title="WeePee TV" }

function main()
local tree = simplexml.parse_url("http://192.168.x.x:8080/input.xml")
    for _, items in ipairs( tree.children ) do
        local url = vlc.strings.resolve_xml_special_chars( items.children_map['h264'][1].children[1] )
        local title = vlc.strings.resolve_xml_special_chars( items.children_map['title'][1].children[1] )
        local arturl = vlc.strings.resolve_xml_special_chars( items.children_map['thumb'][1].children[1] ) { path = url, title = title , arturl = arturl } ) 


  1. So how do you get the SSL certificate installed in VLC?

  2. You don't need to install a SSL certificate, isn't using a self signed one, there shouldn't be an issue. Be sure to use the latest VLC (2.0.5)

    Check out my other post ( about weepeetv and vlc, there's a link to the script generating the XML and more information about how to use it.

  3. Found the problem: because I'm on a Mac :-)
    GnuTLS doesn't support OS X keychain for getting the certificates it seems.

    I got the cert from and put it in ~/Library/Preferences/org.videolan.vlc/ssl/certs/ca-certificates.crt and now I'm in business :)

  4. Hi 42wim,

    with your script I hope to be able to watch weepeetv on my BSD. however i'm also suffering some TLS issues. I know it is not related to your code, but i haven't found any solution - or even a cause of the problem for that matter.

    Perhaps you encountered something similar somewhere during testing or stumbled upon similar problems?

    VLC isn't able to 'read' my CA chain:

    [0x28873f10] gnutls tls client debug: GnuTLS v2.12.18 initialized
    [0x28873f10] gnutls tls client debug: browsing x509 credentials in /home/filip/.local/share/vlc/ssl/certs...
    [0x28873f10] gnutls tls client debug: loading x509 credentials from globalsign-root-bundle-2011.crt...
    [0x28873f10] gnutls tls client warning: cannot read x509 credentials: Bad file descriptor

    permissions are fine...

    i know the CA's are fine too for the cert of weepeetv:

    [filip@gnix ~]$ cat | openssl verify -CAfile .local/share/vlc/ssl/certs/globalsign-root-bundle-2011.crt -purpose sslserver
    stdin: OK

    Even while using gnutls-cli it is accepted:

    [filip@gnix ~]$ gnutls-cli -s --x509cafile .local/share/vlc/ssl/certs/globalsign-root-bundle-2011.crt
    Processed 2 CA certificate(s).
    Resolving ''...
    Connecting to ''...

    - Simple Client Mode:

    *** Starting TLS handshake
    - Certificate[0] info:
    - subject `OU=Domain Control Validated,CN=*', issuer `C=BE,O=GlobalSign nv-sa,CN=GlobalSign Domain Validation CA - G2', RSA key 2048 bits, signed using RSA-SHA1, activated `2012-12-12 10:25:53 UTC', expires `2015-12-13 10:25:53 UTC', SHA-1 fingerprint `70286185fdf0191f72734ea7b8beb920a0927888'
    - Certificate[1] info:
    - subject `C=BE,O=GlobalSign nv-sa,CN=GlobalSign Domain Validation CA - G2', issuer `C=BE,O=GlobalSign nv-sa,OU=Root CA,CN=GlobalSign Root CA', RSA key 2048 bits, signed using RSA-SHA1, activated `2011-04-13 10:00:00 UTC', expires `2022-04-13 10:00:00 UTC', SHA-1 fingerprint `2a3cf4bddc74ccaa480558f9d8d1d2a084f34b31'
    - The hostname in the certificate matches ''.
    - Peer's certificate is trusted

    So everything seems fine, except that gnutls inside vlc is unable to read the CA chain.

    Do you have an idea? Or did you encounter something similar?


  5. Hi Filip,

    No idea, but you can use stunnel to fix this.
    Create stunnel.conf containing this:

    client = yes
    accept =
    # Replace SERVER with the address of the server setup previously
    connect =

    run stunnel stunnel.conf
    adapt the xml file to change to http://localhost:1234

  6. Hey Wim
    I tried to use stunnel so I could play the streams using xbmc, but stunnel fails to start. It says that the server needs a certificate. Maybe you can help me?


  7. Hi Nick, shouldn't be an issue, if it's on a mac however I can't help you