<commit_before># -*- coding: utf-8 -*-
# Module: default
# Author: MathsGrinds
# Created on: 03.04.2016
# License: GPL v.3 https://www.gnu.org/copyleft/gpl.html

import os
import sys
import xbmcaddon
import xbmcgui
import xbmcplugin
import urllib
import requests
import urlparse
from urlparse import parse_qsl
import urllib2
import re
import cookielib
from time import gmtime, strftime
import json
from urllib2 import urlopen

def str2bool(v):
   return v.lower() in ("yes", "true", "t", "1")

#Settings
addon = xbmcaddon.Addon()
quality = str(addon.getSetting('quality'))
SafeMode = str2bool(addon.getSetting('safe'))
RTENewsNowPreferredStream = str(addon.getSetting('RTENewsNowpreferredstream'))
TG4PreferredStream = str(addon.getSetting('TG4preferredstream'))
TV3PreferredStream = str(addon.getSetting('TV3preferredstream'))
ThreeEPreferredStream = str(addon.getSetting('ThreeEpreferredstream'))
UTVPreferredStream = str(addon.getSetting('UTVpreferredstream'))
email = str(addon.getSetting('email'))
password = str(addon.getSetting('password'))

useragent = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0'}

__url__ = sys.argv[0]
__handle__ = int(sys.argv[1])
path = sys.path[0]+"/"

def login():
    try:
    
        #Pre-Defined Accounts;
        t = ['1473377299', '1473372360', '1473368331', '1473323340', '1473321532', '1473317932', '1473314337', '1473312545', '1473287340', '1473285536', '1473284046', '1473282694', '1473280136', '1473279500', '1473265240', '1473264529', '1473263929', '1473263327', '1473262730', '1473262129', '1473261596', '1473260329', '1473259730', '1473259131', '1473258525', '1473258012', '1473257337', '1473256727', '1473256199', '1473255597', '1473254926', '1473254333', '1473254055', '1473253131', '1473252590', '1473252001', '1473251326', '1473250735', '1473250130', '1473249610', '1473248989', '1473248326', '1473247865', '1473247130', '1473246537', '1473245926', '1473245329', '1473244730', '1473244131', '1473243533', '1473242931', '1473242333', '1473241729', '1473241130', '1473240530', '1473239930', '1473239330', '1473238732', '1473238128', '1473237529', '1473236939', '1473236324', '1473235730', '1473235127', '1473234531', '1473233936', '1473233329', '1473232729', '1473232127', '1473231530', '1473230993', '1473230333', '1473229730', '1473229132', '1473228527', '1473227990', '1473227392', '1473226727', '1473226126', '1473225525', '1473224935', '1473224330', '1473223728', '1473223133', '1473222531', '1473221930', '1473221327', '1473220792', '1473220131', '1473219532', '1473218926', '1473218327', '1473217734', '1473217125', '1473216534', '1473215925', '1473215398', '1473214730', '1473214127', '1473213533', '1473212933', '1473212341', '1473211737', '1473211132', '1473210607', '1473209932', '1473209332', '1473208735', '1473208133', '1473207569', '1473206931', '1473206329', '1473205735', '1473205132', '1473204533', '1473203966', '1473203445', '1473202765', '1473202359', '1473201533', '1473200938', '1473200365', '1473199903', '1473199132', '1473198535', '1473197932', '1473197335', '1473196734', '1473196230', '1473195532', '1473194940', '1473194330', '1473193930', '1473193169', '1473192574', '1473192034', '1473191104', '1473190138', '1473189490', '1473188335', '1473187430', '1473186536', '1473185705', '1473184793', '1473183836'][int(strftime("%H", gmtime()))*6 + 1+int(int(strftime("%M", gmtime()))/10)]
        
        #If there isn't both Email and Password set;
        if not email and not password:
        
            #Use a Pre-Defined Free Account;
            req = urllib2.Request('https://api.aertv.ie/v2/users/login', urllib.urlencode({'email':'<EMAIL>'+t+'@<EMAIL>', 'password':'<PASSWORD>'}), useragent)
            
        else:
        
            #Use the Account defined in Settings by the User;
            req = urllib2.Request('https://api.aertv.ie/v2/users/login', urllib.urlencode({'email':email, 'password':password}), useragent)
            
        #Output the JSON;
        html = urllib2.urlopen(req).read()
        return json.loads(html)
        
    except:
    
        #Notify the user that the Email and Password is incorrect;
        xbmc.executebuiltin('Notification(Login Failed, The Email and/or Password is incorrect.)')
        return ""

#Login;<commit_msg>Fix 403 Error<commit_after># -*- coding: utf-8 -*-
# Module: default
# Author: MathsGrinds
# Created on: 03.04.2016
# License: GPL v.3 https://www.gnu.org/copyleft/gpl.html

import os
import sys
import xbmcaddon
import xbmcgui
import xbmcplugin
import urllib
import requests
import urlparse
from urlparse import parse_qsl
import urllib2
import re
import cookielib
from time import gmtime, strftime
import json
from urllib2 import urlopen

def str2bool(v):
   return v.lower() in ("yes", "true", "t", "1")

#Settings
addon = xbmcaddon.Addon()
quality = str(addon.getSetting('quality'))
SafeMode = str2bool(addon.getSetting('safe'))
RTENewsNowPreferredStream = str(addon.getSetting('RTENewsNowpreferredstream'))
TG4PreferredStream = str(addon.getSetting('TG4preferredstream'))
TV3PreferredStream = str(addon.getSetting('TV3preferredstream'))
ThreeEPreferredStream = str(addon.getSetting('ThreeEpreferredstream'))
UTVPreferredStream = str(addon.getSetting('UTVpreferredstream'))
email = str(addon.getSetting('email'))
password = str(addon.getSetting('password'))

useragent = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0'}

__url__ = sys.argv[0]
__handle__ = int(sys.argv[1])
path = sys.path[0]+"/"

def login():
    try:
    
        #Pre-Defined Accounts;
        t = ['1473377299', '1473372360', '1473368331', '1473323340', '1473321532', '1473317932', '1473314337', '1473312545', '1473287340', '1473285536', '1473284046', '1473282694', '1473280136', '1473279500', '1473265240', '1473264529', '1473263929', '1473263327', '1473262730', '1473262129', '1473261596', '1473260329', '1473259730', '1473259131', '1473258525', '1473258012', '1473257337', '1473256727', '1473256199', '1473255597', '1473254926', '1473254333', '1473254055', '1473253131', '1473252590', '1473252001', '1473251326', '1473250735', '1473250130', '1473249610', '1473248989', '1473248326', '1473247865', '1473247130', '1473246537', '1473245926', '1473245329', '1473244730', '1473244131', '1473243533', '1473242931', '1473242333', '1473241729', '1473241130', '1473240530', '1473239930', '1473239330', '1473238732', '1473238128', '1473237529', '1473236939', '1473236324', '1473235730', '1473235127', '1473234531', '1473233936', '1473233329', '1473232729', '1473232127', '1473231530', '1473230993', '1473230333', '1473229730', '1473229132', '1473228527', '1473227990', '1473227392', '1473226727', '1473226126', '1473225525', '1473224935', '1473224330', '1473223728', '1473223133', '1473222531', '1473221930', '1473221327', '1473220792', '1473220131', '1473219532', '1473218926', '1473218327', '1473217734', '1473217125', '1473216534', '1473215925', '1473215398', '1473214730', '1473214127', '1473213533', '1473212933', '1473212341', '1473211737', '1473211132', '1473210607', '1473209932', '1473209332', '1473208735', '1473208133', '1473207569', '1473206931', '1473206329', '1473205735', '1473205132', '1473204533', '1473203966', '1473203445', '1473202765', '1473202359', '1473201533', '1473200938', '1473200365', '1473199903', '1473199132', '1473198535', '1473197932', '1473197335', '1473196734', '1473196230', '1473195532', '1473194940', '1473194330', '1473193930', '1473193169', '1473192574', '1473192034', '1473191104', '1473190138', '1473189490', '1473188335', '1473187430', '1473186536', '1473185705', '1473184793', '1473183836'][int(strftime("%H", gmtime()))*6 + 1+int(int(strftime("%M", gmtime()))/10)]
        
        #If there isn't both Email and Password set;
        if not email and not password:
        
            #Use a Pre-Defined Free Account;
            req = urllib2.Request('http://api.aertv.ie/v2/users/login', urllib.urlencode({'email':'<EMAIL>'+t+'<EMAIL>', 'password':'<PASSWORD>'}), useragent)
            
        else:
        
            #Use the Account defined in Settings by the User;
            req = urllib2.Request('https://api.aertv.ie/v2/users/login', urllib.urlencode({'email':email, 'password':password}), useragent)
            
        #Output the JSON;
        html = urllib2.urlopen(req).read()
        return json.loads(html)
        
    except:
    
        #Notify the user that the Email and Password is incorrect;
        xbmc.executebuiltin('Notification(Login Failed, The Email and/or Password is incorrect.)')
        return ""

#Login;
{'fraction_non_alphanumeric': 0.1739484080873809, 'fraction_numerical': 0.3494073901928887, 'mean_word_length': 5.7718332022029895, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 5, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6727531', 'n_tokens_mistral': 5071, 'n_tokens_neox': 3324, 'n_words': 637}