2017-09-18 8 views
0

사용자 프로필 (프로필 사용자 이름/링크) 만 '전용'으로 설정하면 Facebook 사용자 ID를 얻을 수 있습니까? 예를 들어페이스 북에서 사용자 아이디 얻기

:

https://www.facebook.com/zuck 

나는 SDK와 그래프 API와 함께이 일을 해봤지만 이전의 모든 솔루션이 작동하지 않는 것 같다. 나에게 힌트를 주시겠습니까? 나는 더 나아 가고 싶습니다만 어느 쪽이 옳은지는 모르겠습니다.

+2

되지는 서비스 나 페이스 북 플랫폼 정책의 페이스 북 이용 약관에 의해 허용되지 않습니다 스크래핑없이 가능하지 않음 – WizKid

답변

0

Excel로 할 수 있습니다. 내가 사용하는 매크로를 넣었습니다. 첫 번째 열에 이름을 입력해야하며 GenerateFaceIds 매크로를 실행할 때 두 번째 열에 ID가 생성됩니다. (당신은 IExplorer를 페이스 북에 로그인 할 필요)

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 

결과 :

zuck 4

관련 문제