Created
July 11, 2021 18:19
-
-
Save hetul99/8938734fcf31a05f44fc01264b2263e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib.parse | |
import boto3 | |
print('Loading function') | |
s3 = boto3.client('s3') | |
mt = boto3.client('mediatailor') | |
def lambda_handler(event, context): | |
bucket = event['Records'][0]['s3']['bucket']['name'] | |
key = urllib.parse.unquote_plus(event['Records'][0]['s3']['object']['key'], encoding='utf-8') | |
sourceKey1 = event['Records'] | |
print(sourceKey1) | |
sourceKey = event['Records'][0]['s3']['object']['key'] | |
sk=sourceKey.split("/") | |
name=sk[0] | |
tailorname=name.split(".") | |
print(tailorname) | |
print(sourceKey) | |
VideoContentSourceUrl="https://media-convert-destination-12a5r0kz3z77q.s3.amazonaws.com/"+sk[0]+"/hls" | |
print(VideoContentSourceUrl) | |
response = mt.put_playback_configuration( | |
AdDecisionServerUrl='https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=[avail.random]', | |
Name=tailorname[0], | |
VideoContentSourceUrl="https://media-convert-destination-12a5r0kz3z77q.s3.amazonaws.com/"+sk[0]+"/hls" | |
) | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment