Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions camsoda.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import random
import re
import json
import requests

from streamlink.plugin import Plugin
from streamlink.plugin.api import http
# from streamlink.plugin.api import http
from streamlink.plugin.api import validate
from streamlink.plugin.api import useragents
from streamlink.stream import HLSStream

import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

_url_re = re.compile(r"http(s)?://(www\.)?camsoda\.com/(?P<username>[^\"\']+)")

_api_user_schema = validate.Schema(
Expand Down Expand Up @@ -57,8 +61,9 @@ def _stream_status(self, data_user):
return True

def _get_api_video(self, username):
res = http.get(self.API_URL_VIDEO.format(username, str(random.randint(1000, 99999))), headers=self.headers, verify=False)
data_video = http.json(res, schema=_api_video_schema)
res = requests.get(self.API_URL_VIDEO.format(username, str(random.randint(1000, 99999))), headers=self.headers, verify=False)
data_video = self.session.http.json(res, _api_video_schema)
# data_video = json.loads(str(res.json()), schema=_api_video_schema)
return data_video

def _get_streams(self):
Expand Down