Commit 837df565 authored by Tushar upadhyay's avatar Tushar upadhyay

Added get_embedlink method

parent 631ca606
Pipeline #526 failed with stages
......@@ -349,7 +349,30 @@ class Mega:
return file
# Pass filename and extension to get embed link
# But this should work only for video files
def get_embedlink(self,filename,extension):
Returns a Embed link Only for Video Files
if file name is myvideo.mp4
raise Exception('file extension is required!')
supported_extensions = ['mp4','mpg','3gp','flv','avi']
if(extension in supported_extensions):
file = self.find(f"{filename}.{extension}")
raise Exception('File not found')
file_url = str(self.get_link(file)).split('!')
embed_url = f"{file_url[1]}#{file_url[2]}"
return embed_url
raise Exception('This Extension is not supported')
def get_files(self):'Getting all files...')
files = self._api_request({'a': 'f', 'c': 1, 'r': 1})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment