Код:
def PLAY(name,url,iconimage):
link = 'http://192.168.0.116/watch_video.php?v=' + url #Конструираме адреса за достъп до видеото
nl = 0
match = re.compile('src=(.+?) type="video/mp4" data-res="(.+?)" />').findall(data)
req = urllib2.Request(url)
req.add_header('User-Agent', UA)
response = urllib2.urlopen(req)
#print 'request page url:' + url
data=response.read()
response.close()
nl = nl + 1
li = xbmcgui.ListItem(iconImage=iconimage, thumbnailImage=iconimage, path=nl)
li.setInfo('video', { 'title': name })
try:
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(int(sys.argv[1]), True, li))
except:
xbmc.executebuiltin("Notification('Грешка','Видеото липсва на сървъра!')")
Код:
from requests import get
r = requests.get("http://192.168.0.116/watch_video.php?v=HKD9OYN5KO35")
soup = BeautifulSoup(r.content, "html.parser")
for data in soup.findAll('div', class_='dropdown col-lg-12 pull-right no-padding text-right'):
for a in data.findAll('a'):
print(a.get('href'))
#print(a.text)