I tried to read a video store on Google Drive by get the file data content following the code block below, i don't want to download the file to local, just read & load directly from GD.,
...
def print_file_content(service, file_id):
"""Print a file's content.
Args:
service: Drive API service instance.
file_id: ID of the file.
Returns:
File's content if successful, None otherwise.
"""
try:
# GET FILE'S DATA AND READ
content = service.files().get_media(fileId=file_id).execute()
< CODE - OPEN CONTENT/VIDEO >
#
except Exception as e:
print('An error occurred: %s' % e)
print_file_content(service, file_id)
i got file's data, It has this format:
b'\x1aE\xdf\xa3\x01\x00\x00\x00\x00\x00\x00#B\x86\x81\x01B\xf7\x81\x01B\xf2\x81\x04B\xf3\x81\x08B\x82\x88matroskaB\x87\x81\x04B\x85\x81\x02\x18S\x80g\x01\x00\x00\x00\x00A\xffE\x11M\x9bt\xbeM\xbb\x8cS\xab\x84f\xa9I\x15S\xac\x82\x00\xdfM\xbb\x8cS\xab\x84k\xaeT\x16S\xac\x82\x01\'M\xbb\x8cS\xab\x84g\xc3T\x12S\xac\x82\x01\xafM...'
then tried to read content
by the mean of using: binascii, open(content,'rb'), io.BytesIO
but all is not working, error.
i found a way to open video file is vlc
, but when apply data read
to it by all of above ways, even just paste content
itself, it still not working.
HOW TO READ & OPEN A VIDEO FROM BINARY BYTES DATA OF IT BUT NOT A VIDEO OBJECT?