我想知道如果我得到的只有'仍然可以获得Facebook用户ID。用户的个人资料(个人资料用户名/链接)?
例如:
https://www.facebook.com/zuck
我已尝试使用SDK和图谱API执行此操作,但似乎所有以前的解决方案都无法正常工作。你能给我一个提示吗?我想进一步,但我不确定哪种方式是正确的。
答案 0 :(得分:0)
您可以使用Excel执行此操作。我把我使用的宏。您必须将名称放在第一列中,并在运行GenerateFaceIds宏时在第二列中生成id。 (您需要在IExplorer中登录Facebook)
Sub GenerateFaceIds()
Dim total As Long
total = 1
Do Until IsEmpty(Cells(total, 1)) = True
If (Cells(total, 2) = "") Then
Call faceId(total)
End If
total = total + 1
Loop
MsgBox ("OK")
End Sub
Sub faceId(row As Long)
On Error GoTo ErrHandler
Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")
Dim id As String
id = Cells(row, 1)
With appIE
.Navigate "https://www.facebook.com/" + id
.Visible = False
End With
Do While appIE.Busy
DoEvents
Loop
Text = appIE.Document.Body.innerHTML
posinter = InStr(Text, "profile_owner")
profile_owner = Mid(Text, posinter + 16, 15)
posinter2 = InStr(profile_owner, """")
If posinter2 > 0 Then
profile_owner = Left(profile_owner, posinter2 - 1)
End If
Cells(row, 2) = profile_owner
appIE.Quit
Set appIE = Nothing
ExitSub:
Exit Sub
ErrHandler:
'MsgBox "Something's wrong"
appIE.Quit
Set appIE = Nothing
Resume ExitSub
Resume
End Sub
结果:
扎克4