Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSL Handshake Issue #12

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
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
15 changes: 12 additions & 3 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import urllib2
import ssl

PREFIX = '/video/pbskids'
NAME = 'PBS Kids'
ART = 'art-default.jpg'
Expand All @@ -20,7 +23,10 @@ def Start():
def MainMenu():

oc = ObjectContainer()
json_obj = JSON.ObjectFromURL(PBSKIDS_SHOWS)
req = urllib2.Request(PBSKIDS_SHOWS)
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
show_data = urllib2.urlopen(req, context=ssl_context).read()
json_obj = JSON.ObjectFromString(show_data)

for item in json_obj['items']:
title = item['title']
Expand Down Expand Up @@ -70,8 +76,11 @@ def VideoPage(type, title, slug, start=0):

oc = ObjectContainer(title2=title)
end = start+OFFSET

json_obj = JSON.ObjectFromURL(VIDEO_LIST % (start, end, String.Quote(slug, usePlus=True), type), cacheTime=CACHE_1DAY)

req = urllib2.Request(VIDEO_LIST % (start, end, String.Quote(slug, usePlus=True), type))
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
video_list = urllib2.urlopen(req, context=ssl_context).read()
json_obj = JSON.ObjectFromString(video_list)

for item in json_obj['items']:

Expand Down
16 changes: 13 additions & 3 deletions Contents/Services/URL/PBS Kids/ServiceCode.pys
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import urllib2
import ssl

JSON_URL = 'http://pbskids.org/pbsk/video/api/getVideos/?guid='

####################################################################################################
Expand Down Expand Up @@ -69,14 +72,21 @@ def PlayVideo(url):
break
try: redirect_url = vid_profiles[selected_profile]
except: redirect_url = details['videos'][0]['url']
m3u8_url = JSON.ObjectFromURL(redirect_url + '?format=json')['url']
req = urllib2.Request(redirect_url + '?format=json')
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
data = urllib2.urlopen(req, context=ssl_context).read()
json = JSON.ObjectFromString(data)
m3u8_url = json['url']
# Force http for m3u8, https crashing
m3u8_url = m3u8_url.replace('https:','http:')
# m3u8_url = m3u8_url.replace('https:','http:')
return IndirectResponse(VideoClipObject, key=HTTPLiveStreamURL(url=m3u8_url))

####################################################################################################
def GetJSON(url):

video_id = url.split('guid=')[1]
json = JSON.ObjectFromURL(JSON_URL + video_id)
req = urllib2.Request(JSON_URL + video_id)
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
data = urllib2.urlopen(req, context=ssl_context).read()
json = JSON.ObjectFromString(data)
return json['items'][0]