本文整理汇总了Python中net.set_cookies函数的典型用法代码示例。如果您正苦于以下问题:Python set_cookies函数的具体用法?Python set_cookies怎么用?Python set_cookies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_cookies函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PLAY_STREAM
def PLAY_STREAM(name, url, iconimage, cat):
try:
_name = name.split(" -")[0].replace("[/COLOR]", "").replace("[COLOR yellow]", "")
playername = name.split("- ")[1].replace("[/COLOR]", "").replace("[COLOR yellow]", "")
except:
_name = name.replace("[/COLOR]", "")
playername = name.replace("[/COLOR]", "")
net.set_cookies(cookie_jar)
url = '&mwAction=content&xbmc=1&mwData={"id":%s,"type":"tv"}' % cat
link = net.http_GET(site + url).content
if '"allown":false' in link:
try:
match = re.compile('"message":"(.+?)"').findall(link)
dialog = xbmcgui.Dialog()
dialog.ok("NTV.mx", "", match[0].replace("\/", "/"))
except:
dialog = xbmcgui.Dialog()
dialog.ok("NTV.mx", "", "Please Sign Up To Watch The Streams")
else:
match = re.compile('"src":"(.+?)","type":"rtmp"').findall(link)
rtmp = match[0].replace("\/", "/")
playpath = rtmp.split("live/")[1]
app = "live?" + rtmp.split("?")[1]
url = (
"%s swfUrl=http://ntv.mx/inc/grindplayer/GrindPlayer.swf app=%s playPath=%s pageUrl=http://ntv.mx/?c=2&a=0&p=50 timeout=10"
% (rtmp, app, playpath)
)
liz = xbmcgui.ListItem(playername, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo(type="Video", infoLabels={"Title": playername})
liz.setProperty("IsPlayable", "true")
pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
pl.clear()
pl.add(url, liz)
xbmc.Player().play(pl)
示例2: server
def server():
net.set_cookies(cookie_jar)
a=net.http_GET('http://'+THESITE+'/payments/api/matrix/channels',headers={'User-Agent' :UA}).content
print 'WEB READ'
return a
示例3: onClick
def onClick(self, controlID):
if controlID == 7:
if int(self.getControl(5).isSelected()) > 0: self.card_type = 'master'
if int(self.getControl(6).isSelected()) > 0: self.card_type = 'visa'
xbmc.executebuiltin( "Skin.Reset(AnimeWindowXMLDialogClose)" )
self.close()
self.name = self.getControl(8).getText().replace(' ','%20')
self.card_number = self.getControl(9).getText()
self.expiry_month = self.getControl(10).getText()
self.expiry_year = self.getControl(21).getText()
self.sec_cvv = self.getControl(22).getText()
net.set_cookies(cookie_jar)
url = 'https://www.wliptv.com/?c=8&a=15&oid=%s&card={"type":"%s","number":"%s","name":"%s","month":"%s","year":"%s","cvv":"%s"}'%(self.cat,
self.card_type,
self.card_number,
self.name,
self.expiry_month,
self.expiry_year,
self.sec_cvv)
link = net.http_GET(url, headers={'User-Agent' : UA}).content
data = json.loads(link)
if 'success' in link:
dialog = xbmcgui.Dialog()
winput= data['message']
dialog.ok("IPTV World", '',winput, '')
else:
dialog = xbmcgui.Dialog()
winput= data['message']
dialog.ok("IPTV World", '',winput, '')
if dialog.yesno("IPTV World", "Do You Want To Try Again", ""):
card_payment('thingy.xml',ADDON.getAddonInfo('path'),'DefaultSkin',cat=cat).show()
else: return
示例4: GENRE
def GENRE(name,cat):
_GENRE_=name.lower()
now= datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S').replace(' ','%20')
net.set_cookies(cookie_jar)
url='&mwAction=category&xbmc=2&mwData={"id":"%s","time":"%s","type":"tv"}'%(cat,now)
link = net.http_GET(site+url, headers={'User-Agent' : UA }).content
data = json.loads(link)
channels=data['contents']
uniques=[]
offset= int(data['offset'])
for field in channels:
genre = field['genre']
endTime = field['time_to']
name = field['name'].encode("utf-8")
channel = field['id']
whatsup = field['whatsup'].encode("utf-8")
description = field['descr'].encode("utf-8")
r=re.compile("(.+?)-(.+?)-(.+?) (.+?):(.+?):(.+?)")
matchend = r.search(endTime)
endyear = matchend.group(1)
endmonth = matchend.group(2)
endday = matchend.group(3)
endhour = matchend.group(4)
endminute = matchend.group(5)
endDate = datetime.datetime(int(endyear),int(endmonth),int(endday),int(endhour),int(endminute)) + datetime.timedelta(seconds = offset)
if ADDON.getSetting('tvguide')=='true':
name='%s - [COLOR yellow]%s[/COLOR]'%(name,whatsup)
if genre == _GENRE_:
addDir(name,'url',200,imageUrl+channel+'.png',channel,'',description,now,endDate,whatsup)
setView('movies', 'channels-view')
示例5: CARDDETAILS
def CARDDETAILS(cat):
nameselect = ["Cancel", "Visa", "Mastercard"]
returnselect = ["Cancel", "visa", "master"]
type = returnselect[xbmcgui.Dialog().select("Please Card Type", nameselect)]
if not "Cancel" in type:
name = Search("Name On Card").replace(" ", "%20")
card = Numeric("16 Digit Card Number")
month = Numeric("Expiry Month")
year = Numeric("Expiry Full Year (YYYY)")
cvv = Numeric("Security On Back Of Card (CVV)")
url = (
'https://www.ntv.mx/?c=8&a=15&oid=%s&card={"type":"%s","number":"%s","name":"%s","month":"%s","year":"%s","cvv":"%s"}'
% (cat, type, card, name, month, year, cvv)
)
net.set_cookies(cookie_jar)
link = net.http_GET(url).content
data = json.loads(link)
if "success" in link:
dialog = xbmcgui.Dialog()
winput = data["message"]
dialog.ok("NTV.mx", "", winput, "")
else:
dialog = xbmcgui.Dialog()
winput = data["message"]
dialog.ok("NTV.mx", "", winput, "")
if dialog.yesno("NTV.mx", "Do You Want To Try Again", ""):
CARDDETAILS(cat)
else:
return
示例6: LOGIN_VK
def LOGIN_VK(number,password,GET_URL):
headers = {}
headers.update({'Content-Type': 'application/x-www-form-urlencoded', 'Connection': 'keep-alive',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'gzip,deflate,sdch', 'Accept-Language': 'en-GB,en-US;q=0.8,en;q=0.6',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36'})
html = net.http_GET('http://vk.com')
ip_h = re.search(r'ip_h\"\svalue=\"(.*?)\"', html.content, re.I)
html = net.http_POST('https://login.vk.com/?act=login', {'act':'login','role':'al_frame','expire':'',
'captcha_sid':'','_origin':'http://vk.com','ip_h':ip_h.group(1),
'email':str(number),'pass':str(password)})
if os.path.exists(cookie_path) == False:
os.makedirs(cookie_path)
net.save_cookies(cookie_jar)
net.set_cookies(cookie_jar)
html = net.http_GET(GET_URL).content.replace('\\','')
return html
示例7: PLAY_STREAM
def PLAY_STREAM(name,url,iconimage,cat):
try:
_name=name.split(' -')[0].replace('[/COLOR]','').replace('[COLOR yellow]','')
playername=name.split('- ')[1].replace('[/COLOR]','').replace('[COLOR yellow]','')
except:
_name=name.replace('[/COLOR]','')
playername=name.replace('[/COLOR]','')
net.set_cookies(cookie_jar)
url = '&mwAction=content&xbmc=1&mwData={"id":%s,"type":"tv"}'%cat
link = net.http_GET(site+url, headers={'User-Agent' : UA}).content
if '"allown":false' in link:
try:
match=re.compile('"message":"(.+?)"').findall(link)
dialog = xbmcgui.Dialog()
dialog.ok("NTV.mx", '', match[0].replace('\/','/'))
except:
dialog = xbmcgui.Dialog()
dialog.ok("NTV.mx", '', 'Please Sign Up To Watch The Streams')
else:
match=re.compile('"src":"(.+?)","type":"rtmp"').findall(link)
if match:
url=match[0].replace('\/','/')
else:
match=re.compile('"src":"(.+?)","type":"hls"').findall(link)
hls=match[0].replace('\/','/')
url=hls
liz=xbmcgui.ListItem(playername, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": playername} )
liz.setProperty("IsPlayable","true")
liz.setPath(url)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
示例8: CARDDETAILS
def CARDDETAILS(cat):
nameselect=['Cancel','Visa','Mastercard']
returnselect=['Cancel','visa','master']
type= returnselect[xbmcgui.Dialog().select('Please Card Type', nameselect)]
if not 'Cancel' in type:
name=Search('Name On Card').replace(' ','%20')
card=Numeric('16 Digit Card Number')
month=Numeric('Expiry Month')
year=Numeric('Expiry Full Year (YYYY)')
cvv=Numeric('Security On Back Of Card (CVV)')
url='https://www.wliptv.com/?c=8&a=15&oid=%s&card={"type":"%s","number":"%s","name":"%s","month":"%s","year":"%s","cvv":"%s"}'%(cat,type,card,name,month,year,cvv)
net.set_cookies(cookie_jar)
link = net.http_GET(url, headers={'User-Agent' : UA}).content
data = json.loads(link)
if 'success' in link:
dialog = xbmcgui.Dialog()
winput= data['message']
dialog.ok("IPTV World", '',winput, '')
else:
dialog = xbmcgui.Dialog()
winput= data['message']
dialog.ok("IPTV World", '',winput, '')
if dialog.yesno("IPTV World", "Do You Want To Try Again", ""):
CARDDETAILS(cat)
else:
return
示例9: checksub
def checksub():
print '########################## checking ########################'
username = ADDON.getSetting(‘snusername’)
password = ADDON.getSetting(‘snpassword’)
headers={'Host': THESITE,
'Connection': 'keep-alive',
'Origin': 'http://'+THESITE,
'X-Requested-With': 'XMLHttpRequest',
'User-Agent': 'XBMC',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Referer': 'http://'+THESITE+'/payments/login',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'en-US,en;q=0.8'}
TIME = time.time()- 3600
data={'amember_login':username, 'amember_pass':password , 'login_attempt_id': str(TIME)}
html = net.http_POST('http://sportsmania.eu/payments/login',data,headers).content
if 'true' in html:
net.save_cookies(cookie_amember)
net.set_cookies(cookie_amember)
html = net.http_GET(‘http://sportsmania.eu/payments/member').content
try:
match=re.compile('<h2 id="member-main-subscriptions-head">(.+?)</h2><div class="am-block" id="member-main-subscriptions"> <h3>(.+?)</h3>').findall(html)
line1 = match[0][0].strip()
line2 = match[0][1].strip()
line3 = ''
addDir('No ACtive Subscriptions','',2006,'','','','')
addDir('You need to resign back up or pay','',2006,'','','','')
addDir('@','',2006,'','','','')
addDir('WWW.SPORTSMANIA.EU','',2006,'','','','')
except:
try:
addDir('My Active Subscriptions','',2006,'','','','')
match=re.compile('<li><strong>(.+?)</strong>(.+?)</li>',re.DOTALL).findall(html)
print match
for sub , expiry in match:
sub=sub.strip().replace(' ','')
expiry=expiry.replace('\n',' ').replace(' ','')
addDir('[COLOR white]%s %s[/COLOR]' % (sub,expiry),'',2006,'','','','')
except:
dialog = xbmcgui.Dialog()
if dialog.yesno("Please Check Your Details & Try Again", "Username : "+ADDON.getSetting('user'), "Password : "+ ADDON.getSetting('pass'), "[COLOR red]is Wrong Please....Try Again ?[/COLOR]"):
ADDON.setSetting('user','')
ADDON.setSetting('pass','')
os.remove(SETTINGS)
TryAgain()
else:
EXIT()
示例10: schedule
def schedule():
net.set_cookies(cookie_jar)
response = net.http_GET('https://sportsmania.eu/site/whats-on/')
link = response.content
link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace(' ','').replace(u'\u2013', '')
events=re.findall(r'evo_date.*?>([^<]+)<.*?>([^<]+)<.*?evcal_event_title.*?>([^<]+)',link)
for i in range(len(events)):
addLink('[COLOR greenyellow][B] ' + events[i][0] + ' ' + events[i][1].upper() + ' - ' + events[i][2] + '[/B][/COLOR]','url','','')
xbmc.executebuiltin('Container.SetViewMode(51)')
示例11: BUYSUBS
def BUYSUBS():
net.set_cookies(cookie_jar)
link = net.http_GET("http://ntv.mx/?c=4&a=7").content
data = json.loads(link)
for field in data:
cat = str(field["id"])
name = field["fullname"].encode("utf-8")
description = field["description"].encode("utf-8")
addDir(name, "url", 12, "", cat, "", description)
setView("movies", "channels-view")
示例12: downloadchannel
def downloadchannel():
if os.path.exists(cookie_path) == False:
os.makedirs(cookie_path)
if sessionExpired():
Login()
net.set_cookies(cookie_jar)
a=net.http_GET('http://'+THESITE+'/site/MatrixUp/site/api/matrix/channels',headers={'User-Agent' :UA}).content
f = open(channeljs, mode='w')
f.write(a)
f.close()
示例13: BUYSUBS
def BUYSUBS():
net.set_cookies(cookie_jar)
link = net.http_GET('http://wliptv.com/?c=4&a=7', headers={'User-Agent' : UA}).content
data = json.loads(link)
for field in data:
cat= str(field['id'])
name= field['fullname'].encode("utf-8")
description= field['description'].encode("utf-8")
addDir(name,'url',12,'',cat,'',description)
setView('movies', 'channels-view')
示例14: PAYSUBS
def PAYSUBS(cat):
dialog = xbmcgui.Dialog()
net.set_cookies(cookie_jar)
URL = "http://www.ntv.mx/?c=4&a=8&item_id=%s&amount=1" % cat
link = net.http_GET(URL).content
data = json.loads(link)
if "success" in link:
cat = str(data["body"])
CARDPAY(cat)
elif "failure" in link:
dialog = xbmcgui.Dialog()
winput = data["message"]
dialog.ok("NTV.mx", "", winput, "")
return
else:
if dialog.yesno(
"NTV.mx", "You Have a Similar Subscription", "", "What Do You Want To Do", "Extend", "Create New"
):
print "###################################### CREATE NEW"
link = net.http_GET(URL + "&force=1").content
data = json.loads(link)
if "success" in link:
cat = str(data["body"])
CARDPAY(cat)
elif "failure" in link:
winput = data["message"]
dialog.ok("NTV.mx", "", winput, "")
return
else:
print "###################################### EXTEND"
titlereturn = ["Cancel"]
idreturn = ["Cancel"]
body = data["body"]
candidates = body["candidates"]
for field in candidates:
name = "%s-(%s) [COLOR yellow]%s[/COLOR]" % (field["title"], field["time_left"], field["status_tag"])
titlereturn.append(name)
idreturn.append(field["id"])
cat = idreturn[xbmcgui.Dialog().select("Which Do You Want To Extend", titlereturn)]
if "Cancel" in cat:
print "Cancel"
else:
net.set_cookies(cookie_jar)
url = URL + "&opt=%s" % cat
link = net.http_GET(url).content
data = json.loads(link)
if "success" in link:
cat = str(data["body"])
CARDPAY(cat)
elif "failure" in link:
winput = data["message"]
dialog.ok("NTV.mx", "", winput, "")
return
示例15: LOGOUT
def LOGOUT():
net.set_cookies(cookie_jar)
html = net.http_GET(site).content
match=re.compile(' href="(.+?)">Log Out</a>').findall(html)[0]
net.set_cookies(cookie_jar)
logout = net.http_GET(match.replace('#038;','')).content
if 'You are now logged out' in logout:
print '===============LOGGED OUT !!==============='
dialog = xbmcgui.Dialog()
dialog.ok(THESITE.upper(),'', "You Are Now Logged Out", "")
EXIT()