VVVVID TEST SERVER

This commit is contained in:
Alhaziel
2019-09-21 19:54:13 +02:00
parent 45118f9ff7
commit 1717cd7e54
3 changed files with 154 additions and 0 deletions

55
lib/vvvvid_decoder.py Normal file
View File

@@ -0,0 +1,55 @@
import urllib2
def dec_ei(h):
g = 'MNOPIJKL89+/4567UVWXQRSTEFGHABCDcdefYZabstuvopqr0123wxyzklmnghij'
c = list()
for e in range(0,len(h)):
c.append(g.find(h[e]))
for e in range(len(c)*2-1,-1,-1):
#print 'e=' + str(e)
a = c[e % len(c)] ^ c[(e+1)%len(c)]
#print 'a='+str(a)
c[e%len(c)] = a
#print 'c['+str(e % len(c))+']='+ str(c[e % len(c)])
c = f(c)
d = ''
for e in range(0,len(c)):
d += '%'+ (('0'+ (str(format(c[e],'x'))))[-2:])
return urllib2.unquote(d)
def f(m):
l = list()
o = 0
b = None
while not b and o < len(m):
n = m[o] <<2
o +=1
k = -1
j = -1
if o < len(m):
n += m[o] >> 4
o += 1
if o < len(m):
k = (m[o - 1] << 4) & 255
k += m[o] >> 2
o += 1
if o < len(m):
j = (m[o - 1] << 6) & 255
j += m[o]
o += 1
else:
b = True
else:
b = True
else:
b = True
l.append(n)
if k != -1:
l.append(k)
if j != -1:
l.append(j)
return l

46
servers/vvvvid.json Normal file
View File

@@ -0,0 +1,46 @@
{
"active": true,
"find_videos": {
"ignore_urls": [],
"patterns": [
{
"pattern": "(https://vvvvid-vh.akamaihd.net/i/.*?m3u8)",
"url": "\\1"
},
{
"pattern": "https://www.vvvvid.it/.*?show/([a-z0-9/-]+)",
"url": "https://www.vvvvid.it/show/\\1"
}
]
},
"free": true,
"id": "vvvvid",
"name": "vvvvid",
"settings": [
{
"default": false,
"enabled": true,
"id": "black_list",
"label": "@60654",
"type": "bool",
"visible": true
},
{
"default": 0,
"enabled": true,
"id": "favorites_servers_list",
"label": "@60655",
"lvalues": [
"No",
"1",
"2",
"3",
"4",
"5"
],
"type": "list",
"visible": false
}
],
"thumbnail": ""
}

53
servers/vvvvid.py Normal file
View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
from core import httptools
from core import scrapertools
from lib import jsunpack, vvvvid_decoder
from platformcode import logger
import requests
import re
# Creating persistent session
current_session = requests.Session()
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0'}
# Getting conn_id token from vvvvvvvvvvid and creating payload
login_page = 'https://www.vvvvid.it/user/login'
conn_id = current_session.get(login_page, headers=headers).json()['data']['conn_id']
payload = {'conn_id': conn_id}
logger.info('CONNECTION ID= ' + str(payload))
def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data
if "Not Found" in data or "File was deleted" in data:
return False, "[Watchvideo] El fichero no existe o ha sido borrado"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
video_urls = []
page_url = page_url.replace("/show/","/#!show/")
# Getting info from given URL
show_id = re.findall("#!show/([0-9]+)/", page_url)[0]
name = re.findall(show_id + "/(.+?)/", page_url)[0]
season_id = re.findall(name + "/(.+?)/", page_url)[0]
video_id = re.findall(season_id + "/(.+?)/", page_url)[0]
json_url = "https://www.vvvvid.it/vvvvid/ondemand/" + show_id + '/season/' +season_id + '/'
logger.info('URL= ' + json_url)
json_file = current_session.get(json_url, headers=headers, params=payload).json()
# logger.info(json_file['data'])
for episode in json_file['data']:
# import web_pdb; web_pdb.set_trace()
if episode['video_id'] == int(video_id):
embed_info = vvvvid_decoder.dec_ei(episode['embed_info'])
embed_info = embed_info.replace('manifest.f4m','master.m3u8').replace('http://','https://').replace('/z/','/i/')
# import web_pdb; web_pdb.set_trace()
video_urls.append(['GUARDA IL VIDEO', str(embed_info)])
return video_urls