-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkanal5.py
28 lines (25 loc) · 928 Bytes
/
kanal5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import httplib
from pyamf import remoting
def get_kanal5(video_player):
player_id = 811317479001
publisher_id = 22710239001
const = '9f79dd85c3703b8674de883265d8c9e606360c2e'
env = remoting.Envelope(amfVersion=3)
env.bodies.append(
(
"/1",
remoting.Request(
target="com.brightcove.player.runtime.PlayerMediaFacade.findMediaById",
body=[const, player_id, video_player, publisher_id],
envelope=env
)
)
)
env = str(remoting.encode(env).read())
conn = httplib.HTTPConnection("c.brightcove.com")
conn.request("POST", "/services/messagebroker/amf?playerKey=AQ~~,AAAABUmivxk~,SnCsFJuhbr0vfwrPJJSL03znlhz-e9bk", env, {'content-type': 'application/x-amf'})
response = conn.getresponse().read()
rtmp = ''
for rendition in remoting.decode(response).bodies[0][1].body['renditions']:
rtmp += '"%sx%s:%s";' % (rendition['frameWidth'], rendition['frameHeight'], rendition['defaultURL'])
return rtmp