在Google文档中使用Mechanize(Using Mechanize with Google Docs)
我正在尝试使用Mechanize登录Google Docs以便我可以抓取某些内容(不可能来自API),但在尝试遵循元重定向时,我似乎仍然保持获得404:
require 'rubygems' require 'mechanize' USERNAME = "..." PASSWORD = "..." LOGIN_URL = "https://www.google.com/accounts/Login?hl=en&continue=http://docs.google.com/" agent = Mechanize.new login_page = agent.get(LOGIN_URL) login_form = login_page.forms.first login_form.Email = USERNAME login_form.Passwd = PASSWORD login_response_page = agent.submit(login_form) redirect = login_response_page.meta[0].uri.to_s puts "redirect: #{redirect}" followed_page = agent.get(redirect) # throws a HTTPNotFound exception pp followed_page
任何人都可以看到为什么这不起作用?
I'm trying to use Mechanize login to Google Docs so that I can scrape something (not possible from the API) but I keep seem to keep getting a 404 when trying to follow the meta redirect:
require 'rubygems' require 'mechanize' USERNAME = "..." PASSWORD = "..." LOGIN_URL = "https://www.google.com/accounts/Login?hl=en&continue=http://docs.google.com/" agent = Mechanize.new login_page = agent.get(LOGIN_URL) login_form = login_page.forms.first login_form.Email = USERNAME login_form.Passwd = PASSWORD login_response_page = agent.submit(login_form) redirect = login_response_page.meta[0].uri.to_s puts "redirect: #{redirect}" followed_page = agent.get(redirect) # throws a HTTPNotFound exception pp followed_page
Can anyone see why this isn't working?
原文:https://stackoverflow.com/questions/3001195
最满意答案
只有授权您的应用的朋友才会出现。 如果您未在资源管理器中选择自己的应用程序,那么将使用user_friends权限授权资源管理器应用程序的朋友。
Only friends who authorized your app will show up. If you did not select your own app in the explorer, it will be the friends who authorized the explorer app with the user_friends permission.
相关问答
更多-
这最终只发生在Alice身上 - 其他用户Bob能够评论他们的墙贴。 我正在给爱丽丝弄怪怪Facebook的隐私设置。 This ended up only happening with Alice -- with other users Bob was able to comment on their wall posts. I'm chalking it up to Alice having weird Facebook privacy settings.
-
Facebook API是否允许发送和接受好友请求?(Does Facebook API allow sending and accepting friend requests?)[2019-11-30]
你试过这个吗? 它是推荐的选项,因为api不允许随机添加通话人。 http://developers.facebook.com/docs/reference/dialogs/friends/ 编辑:这里你有android sdk中对话框的参考https://developers.facebook.com/docs/reference/androidsdk/dialog/ Have you tried this ? Its the recommended option since the api doesnt ... -
在你的getMyFriends函数中,对getMyFriends进行API调用 响应中的每个项目看起来都像 { "name": "phwd", "gender": "male", "id": "113702895386410" } 从那里你可以分手。 您还可以执行/FRIEND_ID?fields=name,gender 这些调用当然必须附加访问令牌或通过SDK调用返回。 Within your getMyFriends function make an API c ...
-
Facebook在线朋友(Facebook online friend)[2023-05-13]
您需要user_status权限才能读取user_status的用户状态和user_online_presence和/或friends_online_presence权限。 这是完整的权限列表。 You need the user_status permission to read the user's status and user_online_presence and/or friends_online_presence permissions for the online_presence. Her ... -
我会回复自己:这似乎可以在'friends_online_presence'上使用FQL查询 I'll reply to myself: this seems possible using FQL queries on 'friends_online_presence'
-
只有授权您的应用的朋友才会出现。 如果您未在资源管理器中选择自己的应用程序,那么将使用user_friends权限授权资源管理器应用程序的朋友。 Only friends who authorized your app will show up. If you did not select your own app in the explorer, it will be the friends who authorized the explorer app with the user_friends per ...
-
由于可能会发生滥用,因此无法通过Facebook删除朋友等功能。 您可以发送好友请求,但该应用不应使用此功能来鼓励用户与其他用户在现实生活中无法联系。 Because of possible misuse that might happen, feature like deleting friends via Facebook is not available. You can although send Friend Requests but the app should not use this fea ...
-
我昨晚想到了,忘了回答我自己了......我只能使用/朋友api获得未加密的id,它只返回拥有该应用的朋友。 我没意见 :) I figured it out last night, forgot to answer myself... I can only get unencrypted ids using the /friends api, which return only friends who have the app. Fine by me :)
-
是的,从适用于Android的Facebook SDK开始。 这是一个演示,用于显示用户的朋友 。 您应该能够根据自己的需要进行调整。 Yes, start with the Facebook SDK for Android. Here is a demo, for showing a User's friend. You should be able to adapt it for your needs.
-
您可以使用FQL查询执行此操作 select uid from group_member where gid = xxxx and uid in (select uid2 from friend where uid1 = me() ) 其中xxxx是组ID 或者返回所有组,这可能是: where gid in (select gid from group_member WHERE uid = me()); 这将简单地返回朋友的uid。 然后,您可以使用多查询返回有关它们的更多信息 https://d ...