2014-03-25, 11:01
Hi all,
I'm new to the whole XBMC scene and python programming.
But I'm going to try and make me an addon for XBMC so that I can watch live football from my tv instead of on my laptop.
The problem is that I'm already stuck at the login part. I found that I could use urllib and urllib2 to create a login script.
My code:
The csrf_token is a hidden field in the form which changes value each time, but I don't know if that is the problem.
When I print the_page it looks like I'm still on the https://jouw.foxsports.nl/login loginpage.
Update:
Somehow I now even need to add a captcha function too.
More and more challenges
I'm new to the whole XBMC scene and python programming.
But I'm going to try and make me an addon for XBMC so that I can watch live football from my tv instead of on my laptop.
The problem is that I'm already stuck at the login part. I found that I could use urllib and urllib2 to create a login script.
My code:
PHP Code:
import urllib
import urllib2
import re
def check_login(source):
logged_in_string = 'jouw account'
#search for the string in the html, without caring about upper or lower case
if re.search(logged_in_string,source,re.IGNORECASE):
print 'SUCCESVOL INGELOGD'
else:
print 'NIET INGELOGD'
url = 'https://jouw.foxsports.nl/login'
values = { 'email':'myemail',
'password':'mypassword',
'redirect':'/account',
'csrf_token':'c9d1c944a3be87f46e426bae0179f5b1b2f004c8bce23760c945654da09b3cbd472201cb17338e003e329fbfa6905ec46d3dc48cc55d987c43200bf2a9fc3381',
'login':'Login'
}
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
check_login(the_page,'myemail')
The csrf_token is a hidden field in the form which changes value each time, but I don't know if that is the problem.
When I print the_page it looks like I'm still on the https://jouw.foxsports.nl/login loginpage.
Update:
Somehow I now even need to add a captcha function too.
More and more challenges