我试图在此脚本中设置useragent。
def stream_video(url):
url = str(url).replace('USERNAME',username).replace('PASSWORD',password)
liz = xbmcgui.ListItem('', iconImage='DefaultVideo.png', thumbnailImage=icon)
liz.setInfo(type='Video', infoLabels={'Title': '', 'Plot': ''})
liz.setProperty('IsPlayable','true')
liz.setPath(str(url))
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
我尝试过的所有东西都没有发送我设置的使用者,有谁知道我会如何通过一个使用者呢?
我试过
def stream_video(url):
url = str(url).replace('USERNAME',username).replace('PASSWORD',password)
req = urllib2.Request(url)
req.add_header('User-Agent', UA)
opener = urllib2.build_opener(SmartRedirectHandler())
f = opener.open(req)
link = f.url
liz = xbmcgui.ListItem('', iconImage='DefaultVideo.png', thumbnailImage=icon)
liz.setInfo(type='Video', infoLabels={'Title': '', 'Plot': ''})
liz.setProperty('IsPlayable','true')
liz.setPath(str(url))
headers = ({'User-Agent': 'Kodi/21.1 (Linux; Android 6.0.1; p212 Build/MHC19J) Android/6.0.1 Sys_CPU/armv8l App_Bitness/32 Version/21.1-Git:2017-11-20-c327c53-dirty'})
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)