Google Drive indexableText用于Python视频

2024-04-20 08:46:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试将indexable text添加到已在驱动器中的视频中。从Drive SDK Docs开始,我使用了Patch方法。你知道吗

def add_indexable_text(service, file_id, text_to_index):
  try:
    file = {'indexableText': {'text': text_to_index}}
    updated_file = service.files().patch(
      fileId = file_id,
      body = file,
      fields = 'indexableText').execute()

    return updated_file
  except errors.HttpError, error:
    print 'An error occurred: %s' % error
    return None

我没有在终端中看到任何错误,但是当我在驱动器中搜索元数据文本时,没有结果。我试着等了一段时间,但似乎没用。视频说是我运行脚本时更新的,所以有东西。谢谢你的帮助。你知道吗

更新:似乎我只能在视频中添加一次可索引文本,但之后不能更改。你知道吗


Tags: totext文本idindex视频returnservice
1条回答
网友
1楼 · 发布于 2024-04-20 08:46:15

代码在我看来很好。试着使用文档的“Try it”功能,这样行吗?你知道吗

https://developers.google.com/drive/v2/reference/files/patch

可能请求已通过但失败,这不会导致HttpError。你知道吗

典型调用的返回值是多少?你知道吗

相关问题 更多 >