Fix streamSB

This commit is contained in:
marco
2023-04-29 17:19:43 +02:00
parent e19b5245d8
commit ff4b428e1b
2 changed files with 24 additions and 2 deletions

View File

@@ -26,5 +26,11 @@
"label": "@70708", "label": "@70708",
"type": "bool", "type": "bool",
"visible": true "visible": true
},{
"default": 16,
"enabled": true,
"id": "number",
"type": "int",
"visible": false
}] }]
} }

View File

@@ -1,5 +1,5 @@
from core import httptools from core import httptools
from platformcode import config, logger from platformcode import config, logger, platformtools
import random, string import random, string
import codecs import codecs
@@ -9,9 +9,25 @@ def get_sources(page_url):
rand1 = "".join([random.choice(string.ascii_letters) for y in range(12)]) rand1 = "".join([random.choice(string.ascii_letters) for y in range(12)])
rand2 = "".join([random.choice(string.ascii_letters) for y in range(12)]) rand2 = "".join([random.choice(string.ascii_letters) for y in range(12)])
_0x470d0b = '{}||{}||{}||streamsb'.format(rand1, code, rand2) _0x470d0b = '{}||{}||{}||streamsb'.format(rand1, code, rand2)
sources = 'https://streamas.cloud/sources15/' + codecs.getencoder('hex')(_0x470d0b.encode())[0].decode()
prefix = 'https://streamas.cloud/sources'
suffix = '/' + codecs.getencoder('hex')(_0x470d0b.encode())[0].decode()
number = config.get_setting('number', server='streamsb')
sources = prefix + str(number) + suffix
# does not lite other headers different than watchsb and useragent # does not lite other headers different than watchsb and useragent
ret = httptools.downloadpage(sources, headers={'watchsb': 'sbstream', 'User-Agent': httptools.get_user_agent()}, replace_headers=True).json ret = httptools.downloadpage(sources, headers={'watchsb': 'sbstream', 'User-Agent': httptools.get_user_agent()}, replace_headers=True).json
if not ret: # probably number changed
wait = platformtools.dialog_progress('StreamSB', config.get_localized_string(60293))
for number in range(100):
if httptools.downloadpage(prefix + str(number) + '/').code == 200:
config.set_setting('number', server='streamsb', value=number)
sources = prefix + str(number) + suffix
# does not lite other headers different than watchsb and useragent
ret = httptools.downloadpage(sources,
headers={'watchsb': 'sbstream', 'User-Agent': httptools.get_user_agent()},
replace_headers=True).json
break
wait.close()
logger.debug(ret) logger.debug(ret)
return ret return ret