diff --git a/skilldown.py b/skilldown.py index ffdfd2d..9c2fbdb 100755 --- a/skilldown.py +++ b/skilldown.py @@ -9,13 +9,13 @@ sep = input("Are audio and video in the Same or Different files? [S|D]") sep = sep.lower() if not(sep=='s' or sep=='d'): raise ValueError("The answer should be S or D") -#video +#video o video+so si junt i=0 while True: v = i i += 1 - #url del video!!!!!!!!!!!!!! + #url del video!!!!!!!!!!!!!! o video+so si junt url= 'https://house-fastly-signed-us-east-1-prod.brightcovecdn.com/media/v1/hls/v4/clear/3695997568001/0df46668-c157-40a2-aeab-845c32d4eae3/d7cb636b-ca37-4bed-9248-0e494c526027/5x/segment'+str(v)+'.ts?fastly_token=NWUxNzNiNWFfMmM3NDk0NGU1NjE4NWM0MTE3MWQ4NjY1MGIwMGNhOGE2ZWI2NTc1NmQ2N2E1ODc3YjhjNzkxMjlhOWQyZTUzM18vL2hvdXNlLWZhc3RseS1zaWduZWQtdXMtZWFzdC0xLXByb2QuYnJpZ2h0Y292ZWNkbi5jb20vbWVkaWEvdjEvaGxzL3Y0L2NsZWFyLzM2OTU5OTc1NjgwMDEvMGRmNDY2NjgtYzE1Ny00MGEyLWFlYWItODQ1YzMyZDRlYWUzL2Q3Y2I2MzZiLWNhMzctNGJlZC05MjQ4LTBlNDk0YzUyNjAyNy8%3D' #url from media request without de number and .ts at the end url=str(url) print(url) @@ -34,35 +34,38 @@ while True: os.system("cat *"+str(v)+".ts >> all.ts") os.system("ffmpeg -i all.ts -acodec copy -vcodec copy video.mp4") +if sep=='s': + os.system("mv video.mp4 output.mp4") os.system("rm *.ts") -#so -i=0 -while True: - v = i - i += 1 - - #url del so!!!!!!!!!!!!!! - url= 'https://house-fastly-signed-us-east-1-prod.brightcovecdn.com/media/v1/hls/v4/clear/3695997568001/0df46668-c157-40a2-aeab-845c32d4eae3/600d909e-91a6-4f5c-b70b-2fe049618325/5x/segment'+str(v)+'.ts?fastly_token=NWUxNzNiNWFfNDI3ZDlkODIxM2U2YjBmY2E3MDlhYzhkOTcxYWI3YWRlOGUyOTgzYmQzZjJlZDYyYWRhNGIyMDJmZjZhNjMwYl8vL2hvdXNlLWZhc3RseS1zaWduZWQtdXMtZWFzdC0xLXByb2QuYnJpZ2h0Y292ZWNkbi5jb20vbWVkaWEvdjEvaGxzL3Y0L2NsZWFyLzM2OTU5OTc1NjgwMDEvMGRmNDY2NjgtYzE1Ny00MGEyLWFlYWItODQ1YzMyZDRlYWUzLzYwMGQ5MDllLTkxYTYtNGY1Yy1iNzBiLTJmZTA0OTYxODMyNS8%3D' #url from media request without de number and .ts at the end - url=str(url) - print(url) - try: - urlopen(url) - wget.download(url) - print('\n next \n') - except HTTPError as e: - if e.code == 403: - wget.download(url) - continue - else: - print('\n end \n') - break - - os.system("cat *"+str(v)+".ts >> all.ts") - -os.system("ffmpeg -i all.ts -acodec copy -vcodec copy so.mp4") -os.system("rm *.ts") - -#ajuntar -os.system("ffmpeg -i video.mp4 -i so.mp4 -c:v copy -c:a aac -strict experimental output.mp4") -os.system("rm video.mp4 so.mp4") +if sep=='d': + #so + i=0 + while True: + v = i + i += 1 + + #url del so!!!!!!!!!!!!!! + url= 'https://house-fastly-signed-us-east-1-prod.brightcovecdn.com/media/v1/hls/v4/clear/3695997568001/0df46668-c157-40a2-aeab-845c32d4eae3/600d909e-91a6-4f5c-b70b-2fe049618325/5x/segment'+str(v)+'.ts?fastly_token=NWUxNzNiNWFfNDI3ZDlkODIxM2U2YjBmY2E3MDlhYzhkOTcxYWI3YWRlOGUyOTgzYmQzZjJlZDYyYWRhNGIyMDJmZjZhNjMwYl8vL2hvdXNlLWZhc3RseS1zaWduZWQtdXMtZWFzdC0xLXByb2QuYnJpZ2h0Y292ZWNkbi5jb20vbWVkaWEvdjEvaGxzL3Y0L2NsZWFyLzM2OTU5OTc1NjgwMDEvMGRmNDY2NjgtYzE1Ny00MGEyLWFlYWItODQ1YzMyZDRlYWUzLzYwMGQ5MDllLTkxYTYtNGY1Yy1iNzBiLTJmZTA0OTYxODMyNS8%3D' #url from media request without de number and .ts at the end + url=str(url) + print(url) + try: + urlopen(url) + wget.download(url) + print('\n next \n') + except HTTPError as e: + if e.code == 403: + wget.download(url) + continue + else: + print('\n end \n') + break + + os.system("cat *"+str(v)+".ts >> all.ts") + + os.system("ffmpeg -i all.ts -acodec copy -vcodec copy so.mp4") + os.system("rm *.ts") + + #ajuntar + os.system("ffmpeg -i video.mp4 -i so.mp4 -c:v copy -c:a aac -strict experimental output.mp4") + os.system("rm video.mp4 so.mp4")