Added user agent to bypass new block

This commit is contained in:
Giulio 2018-10-02 14:49:31 +02:00
parent 46abefd447
commit 8583540619

View File

@ -3,6 +3,8 @@ import json
import requests import requests
import sqlite3 import sqlite3
ua = "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4.2) Gecko/20020502 CS 2000 7.0/7.0"
def ds(h): def ds(h):
g = "MNOPIJKL89+/4567UVWXQRSTEFGHABCDcdefYZabstuvopqr0123wxyzklmnghij" g = "MNOPIJKL89+/4567UVWXQRSTEFGHABCDcdefYZabstuvopqr0123wxyzklmnghij"
@ -57,17 +59,17 @@ def ds(h):
return d return d
def get_settings(): def get_settings():
settings = requests.get('https://www.vvvvid.it/vvvvid/settings') settings = requests.get('https://www.vvvvid.it/vvvvid/settings', headers={'User-Agent': ua})
if settings.status_code != 200: if settings.status_code != 200:
return None return None
return settings.json()['data']['defaultStreamingServer'] return settings.json()['data']['defaultStreamingServer']
def login(): def login():
login = requests.get('https://www.vvvvid.it/user/login') login = requests.get('https://www.vvvvid.it/user/login', headers={'User-Agent': ua})
return login.json()['data']['conn_id'] return login.json()['data']['conn_id']
def get_info(show_id, conn_id): def get_info(show_id, conn_id):
info = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/info/?conn_id=' + conn_id) info = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/info/?conn_id=' + conn_id, headers={'User-Agent': ua})
info.encoding = 'utf-8' info.encoding = 'utf-8'
if info.json()['result'] == 'ok': if info.json()['result'] == 'ok':
return info.json()['data'] return info.json()['data']
@ -75,14 +77,14 @@ def get_info(show_id, conn_id):
return False return False
def get_seasons(show_id, conn_id): def get_seasons(show_id, conn_id):
seasons = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/seasons/?conn_id=' + conn_id) seasons = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/seasons/?conn_id=' + conn_id, headers={'User-Agent': ua})
if seasons.json()['result'] == 'ok' and seasons.json()['data'] and seasons.json()['data'][0]['episodes']: if seasons.json()['result'] == 'ok' and seasons.json()['data'] and seasons.json()['data'][0]['episodes']:
return seasons.json()['data'] return seasons.json()['data']
else: else:
return False return False
def get_episodes(season_id, show_id, conn_id): def get_episodes(season_id, show_id, conn_id):
episodes = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/season/' +str(season_id) + '?conn_id=' + conn_id) episodes = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/season/' +str(season_id) + '?conn_id=' + conn_id, headers={'User-Agent': ua})
if episodes.json()['result'] == 'ok' and episodes.json()['data'] and episodes.json()['data'][0]['embed_info']: if episodes.json()['result'] == 'ok' and episodes.json()['data'] and episodes.json()['data'][0]['embed_info']:
return episodes.json()['data'] return episodes.json()['data']
else: else: