是否可以抓取所有可见图像+您的一位朋友在 Facebook 上的标记位置?

发布于 2024-12-28 03:26:23 字数 180 浏览 2 评论 0原文

我想选择一个用户(其图像是公开的并且对我来说是可见的,也就是 Facebook 上的当前朋友)并下载该人的所有可查看图片,以及他们在该图片中的标签位置。无论如何,这对我来说都是公开的,所以这不应该是一个问题,我只是不确定如何提取图像上的标记位置。

oyu 可以通过 Facebook API 或其他方式做到这一点吗?你会怎么做?

I want to select a user (whose images are public and viewable to me, aka a current friend on facebook) and download all viewable pictures of that person, along with the location of the tag of them in that picture. This is all publicly available to me anyway, so it shouldn't be an issue, I'm just not sure how to extract the tagged location on the image.

Is this something oyu can do through the Facebook API or through some other means? How would you do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故事和酒 2025-01-04 03:26:24

此信息无法通过他们的 Graph API 获得,因为获取用户信息需要用户授权您的应用程序,或者该人必须是批准您的应用程序的用户的朋友。你可以抓取 Facebook 的网站,但这违反了他们的服务条款,而且很棘手,因为他们采取了很多措施来防止抓取。

This information won't be available via their Graph API because getting user info requires the user to authorize your app, or the person must be friends with the user that approved your app. You could scrape Facebook's site but this is against their terms of service, and is tricky because they have a lot of measures put in place to prevent scraping.

阳光的暖冬 2025-01-04 03:26:24

您需要向用户请求 friends_photos 权限才能访问该信息。

在未经用户明确授权的情况下下载用户照片是一种非常严重的行为令人讨厌和侵入性的事情(除了违反 Facebook 平台政策之外)。如果我看到这种行为,该应用程序将被坚决报告,并且您的个人帐户也将被停用或阻止打开新的应用程序,直到违规应用程序问题得到相应处理。

You will need to ask your users for the friends_photos permission in order to gain access to that information.

Downloading a users photos with out his/her explicit authorization is a very nasty and intrusive thing to do (in addition to violating facebooks platform policies). If I were to see this behavior the application would defiantly be reported and the changes are that your personal account would also be deactivated or prevented from opening new applications until the violating application issue is dealt with accordingly.

耶耶耶 2025-01-04 03:26:24

我使用像下面的 AppleScript 这样的脚本,尽管它只生成缩略图的 URL 列表,而不是全尺寸图像,并且它不会标记位置。

paragraphs of (do shell script "cat /tmp/ids_of_users")
repeat with user in result
    set s to "open -gagoogle\\ chrome https://www.facebook.com/profile.php?id=" & user & "\\&sk=photos_albums"
    tell application "Google Chrome"
        close windows
        repeat until exists window 1 -- the open command sometimes results in an `LSOpenURLsWithRole() failed` error
            do shell script s
            delay 5
        end repeat
        repeat while loading of tabs of window 1 contains true
            delay 1
        end repeat
      tell active tab of window 1
          set albums to execute javascript "o='';a=document.querySelectorAll('.albumThumbLink');for(i=0;e=a[i];i++){o+=e.href+'\\n'};o"
      end tell
      if albums is not missing value and albums is not "" then
          repeat with p in paragraphs 1 thru -2 of albums
              do shell script "open -jgagoogle\\ chrome " & quoted form of p
              delay 1
          end repeat
          repeat while loading of tabs of window 1 contains true
              delay 1
          end repeat
              tell application "Google Chrome" to tell active tab of window 1
                  repeat while loading is true
                      delay 1
                  end repeat
                  set src to execute javascript "document.body.innerHTML"
                  if src contains "no photos in this album" then exit repeat
                  if src contains "you may not have permission to view this page" then return -- your account got restricted for a week by Facebook
                  set prev to 0
                  repeat
                      set y to execute javascript "document.querySelector('.fbTimelineStarGridSeparator').scrollIntoView();window.scrollY"
                      delay 1
                      if y is prev then exit repeat
                      set prev to y
                  end repeat
                  set out to execute javascript "o='';a=document.querySelectorAll('.tagWrapper i');for(i=0;e=a[i];i++)o+=e.getAttribute('style').replace(/.*?\\(/,'').replace(/\\).*/,'')+'\\n';o"
                  if out is not "" then
                      do shell script "printf %s " & quoted form of out & "|sed s/^/" & user & "\\ />>/tmp/albums"
                  end if
              end tell
          end if
        end tell
end repeat

我使用如下所示的脚本来创建较大版本图像的列表,这些图像的大小最大为 960 x 960 像素,因此它们并不总是完整尺寸的版本。

paragraphs of (do shell script "cat /tmp/ids_of_images")
repeat with photoid in result
    tell application "Google Chrome"
        close windows
        repeat until exists window 1
            do shell script "open -gagoogle\\ chrome https://www.facebook.com/" & photoid
            delay 5
        end repeat
        repeat while loading of tabs of window 1 contains true
            delay 1
        end repeat
        tell active tab of window 1
            set src to execute javascript "document.querySelector('.spotlight').src"
            if src is not missing value then
                do shell script "echo '" & src & "'>>/tmp/bigger"
            end if
        end tell
    end tell
end repeat

有些照片通常不会显示在所有照片的页面上,而是在单独浏览相册时显示。

https://www.facebook.com/profile.php?id=&sk=photos_albums 重定向到用户相册页面,https: //www.facebook.com/profile.php?id=&sk=photos_all 重定向到用户发布的所有照片的页面,并且https://www.facebook.com/<图像或用户的fbid>重定向到图像或用户的页面。

当我加载超过一千或几千个页面后,我的帐户有时会受到一周的限制,这样我就无法查看不是我朋友的用户的个人资料。

图像文件名中第二个下划线分隔字段中的数字是图像的 ID,例如 12208495_10102454385528521_4749095086285673716_n.jpg 中的 10102454385528521

用户 ID 是以 a. 开头的相册标识符中的最后一个数字,以及以 fb. 开头的相册标识符中的第一个数字。

https://www.facebook.com/photo/download/?fbid= 曾经被重定向到图像的完整尺寸版本,但今年早些时候停止工作。

https://graph.facebook.com//picture?width=9999 被重定向到用户的完整尺寸个人资料图片,即使 Graph API 不可用,该图片仍然有效可用时间更长。

I use a script like the AppleScript below, even though it only makes a list of the URLs of thumbnails and not full-size images, and it does not get tagged locations.

paragraphs of (do shell script "cat /tmp/ids_of_users")
repeat with user in result
    set s to "open -gagoogle\\ chrome https://www.facebook.com/profile.php?id=" & user & "\\&sk=photos_albums"
    tell application "Google Chrome"
        close windows
        repeat until exists window 1 -- the open command sometimes results in an `LSOpenURLsWithRole() failed` error
            do shell script s
            delay 5
        end repeat
        repeat while loading of tabs of window 1 contains true
            delay 1
        end repeat
      tell active tab of window 1
          set albums to execute javascript "o='';a=document.querySelectorAll('.albumThumbLink');for(i=0;e=a[i];i++){o+=e.href+'\\n'};o"
      end tell
      if albums is not missing value and albums is not "" then
          repeat with p in paragraphs 1 thru -2 of albums
              do shell script "open -jgagoogle\\ chrome " & quoted form of p
              delay 1
          end repeat
          repeat while loading of tabs of window 1 contains true
              delay 1
          end repeat
              tell application "Google Chrome" to tell active tab of window 1
                  repeat while loading is true
                      delay 1
                  end repeat
                  set src to execute javascript "document.body.innerHTML"
                  if src contains "no photos in this album" then exit repeat
                  if src contains "you may not have permission to view this page" then return -- your account got restricted for a week by Facebook
                  set prev to 0
                  repeat
                      set y to execute javascript "document.querySelector('.fbTimelineStarGridSeparator').scrollIntoView();window.scrollY"
                      delay 1
                      if y is prev then exit repeat
                      set prev to y
                  end repeat
                  set out to execute javascript "o='';a=document.querySelectorAll('.tagWrapper i');for(i=0;e=a[i];i++)o+=e.getAttribute('style').replace(/.*?\\(/,'').replace(/\\).*/,'')+'\\n';o"
                  if out is not "" then
                      do shell script "printf %s " & quoted form of out & "|sed s/^/" & user & "\\ />>/tmp/albums"
                  end if
              end tell
          end if
        end tell
end repeat

I use a script like the one below to make a list of larger versions of images, which are up to 960 by 960 pixels large, so that they are not always the full size versions.

paragraphs of (do shell script "cat /tmp/ids_of_images")
repeat with photoid in result
    tell application "Google Chrome"
        close windows
        repeat until exists window 1
            do shell script "open -gagoogle\\ chrome https://www.facebook.com/" & photoid
            delay 5
        end repeat
        repeat while loading of tabs of window 1 contains true
            delay 1
        end repeat
        tell active tab of window 1
            set src to execute javascript "document.querySelector('.spotlight').src"
            if src is not missing value then
                do shell script "echo '" & src & "'>>/tmp/bigger"
            end if
        end tell
    end tell
end repeat

Some photos are often not shown on the page for all photos but are shown when albums are browsed individually.

https://www.facebook.com/profile.php?id=<user id>&sk=photos_albums is redirected to the page for the albums of a user, https://www.facebook.com/profile.php?id=<user id>&sk=photos_all is redirected to the page for all photos posted by a user, and https://www.facebook.com/<fbid of image or user> is redirected to the page for an image or a user.

After I have loaded more than about a thousand or a few thousand pages, my account sometimes gets restricted for a week so that I cannot view the profiles of users who are not my friends.

The number in the second underscore-delimited field in the filename of an image is the ID of the image, or for example 10102454385528521 in 12208495_10102454385528521_4749095086285673716_n.jpg.

The user ID is the last number in an album identifier that starts with a. and the first number in an album identifier that starts with fb..

https://www.facebook.com/photo/download/?fbid=<fbid of photo> used to be redirected to the full size version of an image, but that stopped working earlier this year.

https://graph.facebook.com/<user id>/picture?width=9999 is redirected to the full size profile picture of a user, which still works even though the Graph API is no longer available.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文