gpt4 book ai didi

excel - 获取Google相册中所有文件的列表

转载 作者:行者123 更新时间:2023-12-02 07:30:07 35 4
gpt4 key购买 nike

我的最终目标是获得一个列表,其中包含我的Google相册帐户中的所有文件(照片,视频),最好是其路径。
enter image description here

如果我必须使用某些API,我宁愿使用基于.NET的API。您能在这件事上提供一些指导吗?

我已经通过PicasaService尝试了Gdata API,但由于提供凭据而无法提供我的电子邮件/密码,并且我始终会收到404响应。

最佳答案

This answer is outdated and will no longer work as Picasa and its API have been shut down


如何列出您的Google相册中的所有文件:
我很惊讶我花了多长时间找到这个API。它不一定是“ secret 信息”,但我想大多数用户都非常乐意以“老式方式”查看他们的Google相册。我的最初目标是能够确定哪些照片没有/没有正确上传,然后再冒删除像我的旧照片“第三次备份”一样有值(value)的风险。
  • 就像生活中的许多事情一样,有一种简单方法和一种困难方法
  • 根据您的观点,困难的方法通常会更有趣和/或更充实。

  • 简短答案:(“轻松”方式)
  • 确保您已在“常规”(默认)浏览器上登录到 Google Account
  • 单击此:
    https://picasaweb.google.com/data/feed/api/user/default

  • 您会获得所有Google相册的基于文本的列表。相册列表和照片列表看起来都像RSS源(可疑的,如果需要,可以将其加为书签)。

    我知道您不想手动 复制照片列表,但是我怀疑遇到此问题的其他人都希望采用“简便”的方法:
  • 打开API URL后,单击第一个相册链接。
  • 按Ctrl + A,然后按Ctrl + C从页面复制文本
  • 转到您喜欢的文本编辑器(Notepad++,Excel,oldschool记事本等),然后按Ctrl + V
  • 返回照片列表,单击浏览器的“后退”按钮,然后为每个相册重复此操作。

  • 身份验证:为了简单起见,首先 确保您已从任何Google页面(例如Google Search page的右上角)登录到您的Google帐户。这将允许您使用下面列出的通用地址-否则,“ default”一词将需要替换为您的Google ID以及为适应 Google API Authentication而进行的其他更改。

    API端点
    如果您有发送 GET requests的首选方法,则只需要两个URL。
    据我了解, 所有 Google相册都存储在 相册中(即使它们似乎不是)。因此,为了列出所有照片,您必须解析所有相册,并在每张相册中列出照片。
    列出您的Google相册的 GET调用是:
    https://picasaweb.google.com/data/feed/api/user/default
    列出相册中所有照片的 GET调用是:
    https://picasaweb.google.com/data/feed/api/user/default/albumid/__[albumID]__

    以编程方式检索列表:(“ .NET API”方式)
    Google .NET示例:
    PhotoQuery query = new PhotoQuery(PicasaQuery.CreatePicasaUri(username, albumid));

    PicasaFeed feed = service.Query(query);

    foreach (PicasaEntry entry in feed.Entries)
    {
    Console.WriteLine(entry.Title.Text);
    }

    ★ The string "default" can be used in place of a real username, in which case the server will use the username of the current user credentials used to authenticate the request.


    更多信息: Google Picasa .NET Developer's Guide: Request a List of Photos

    列出所有使用VBA的Google照片:(使用Excel的“Web抓取方式”)
    Excel具有各种格式的内置XML解析功能:
  • Import XML Data(“开发人员”选项卡)Excel 2007+
  • Connect to an XML file( super 查询)Excel 2010+
  • Webservice & FilterXML(工作表功能)Excel 2013+

  • ...但是,即使最新的功能似乎也不能支持XML样式/源的足够(我认为是)变体,以至于对我有用...(或者我做错了什么。
    因此,我解析XML的首选方法是简单地使用 HttpRequest将其加载到String中,然后使用 InstrMid定位我感兴趣的值。这很麻烦,但是我将其用作“快速修复”从几种类型的站点检索几种类型的数据。

    While writing this answer I seem to have misplaced my related code (side effect of over-multitasking?!) -- but if you made it this far, you probably get the gist of it. The simple function for retrieving the source from a URL is below. If you're interested in seeing the rest, add a comment and I'll look harder. :-)

    Public Function getHTTP(ByVal url As String) As String
    'equivalent to Excel's WEBSERVICE function
    Dim encResp() As Byte, xmlHTTP As Object
    Set xmlHTTP = CreateObject("MSXML2.XMLHTTP") 'create XML/HTTP object
    xmlHTTP.Open "GET", url, False 'initialize GET request
    xmlHTTP.send 'send request to remote server
    encResp = xmlHTTP.responseBody 'receive raw (encoded) response
    Set xmlHTTP = Nothing 'always clean up after yourself!
    getHTTP = StrConv(encResp, vbUnicode) 'return decoded response
    End Function
    这也是一种快速计算另一个字符串中另一个字符串的出现的偷偷摸摸的方法:
    Function countOccur(searchWithin As String, toFind As String) As String
    'returns the count of occurrences of [toFind] within [searchWithin]
    countOccur = UBound(Split(searchWithin, toFind))
    End Function
    计算相册或照片页面上 <entry>的出现次数将返回该页面上的相册或照片的计数。

    相关链接:
  • Picasa Web Albums Data API Reference
  • MSDN:About Native XMLHTTP
  • Using Microsoft's XMLHTTP Object to Get Data From Other Web Pages
  • MSDN:responseBody Property (IXMLHTTPRequest)
  • 关于excel - 获取Google相册中所有文件的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36871477/

    35 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com