forked from moromete/plugin.video.streams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
play_vk_com.py
39 lines (33 loc) · 1.11 KB
/
play_vk_com.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import xbmc, xbmcgui
import os, os.path, re
import glob
from glob import addon_log, ADDON_PATH, Downloader, message, addon
def grab_vk_stream(name, url):
temp = os.path.join(ADDON_PATH,"temp.htm")
Downloader(url, temp, addon.getLocalizedString(30065), name) #Downloading page for parsing stream url
f = open(temp)
source_txt = f.read()
f.close()
os.remove(temp)
#addon_log(source_txt)
match=re.compile('url720=(http:\/\/[\w\W]+?.mp4)&').search(source_txt)
if match:
stream_url = match.group(1)
addon_log('720 = '+stream_url)
return stream_url
match=re.compile('url480=(http:\/\/[\w\W]+?.mp4)&').search(source_txt)
if match:
stream_url = match.group(1)
addon_log('480 = '+stream_url)
return stream_url
match=re.compile('url360=(http:\/\/[\w\W]+?.mp4)&').search(source_txt)
if match:
stream_url = match.group(1)
addon_log('360 = '+stream_url)
return stream_url
match=re.compile('url240=(http:\/\/[\w\W]+?.mp4)&').search(source_txt)
if match:
stream_url = match.group(1)
addon_log('240 = '+stream_url)
return stream_url
return None