1

Cursors変数なしで最初の5000のIDを取得するためにすべてのコードが正常に機能するという問題がありますが、コード全体に追加するとすぐに動作が停止し、ここでは何も返されません作業コード..

  Dim oauth_token = ""
        Dim oauth_token_secret = ""
        Dim oauth_consumer_key = ""
        Dim oauth_consumer_secret = ""

        ' oauth implementation details
        Dim oauth_version = "1.0"
        Dim oauth_signature_method = "HMAC-SHA1"

        ' unique request details
        Dim oauth_nonce = Convert.ToBase64String(New ASCIIEncoding().GetBytes(DateTime.Now.Ticks.ToString()))
        Dim timeSpan = DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0, _
            0, DateTimeKind.Utc)
        Dim oauth_timestamp = Convert.ToInt64(timeSpan.TotalSeconds).ToString()

        ' message api details
        Dim status = "Updating status via REST API if this works"
        Dim resource_url = "https://api.twitter.com/1.1/followers/ids.json"

        Dim screen_name = "SimplyBenGenius"
        Dim count = "5000"
        Dim cursor = "-1"
        ' create oauth signature
        Dim baseFormat = "count={7}&oauth_consumer_key={0}&oauth_nonce={1}&oauth_signature_method={2}" + "&oauth_timestamp={3}&oauth_token={4}&oauth_version={5}&screen_name={6}"

        Dim baseString = String.Format(baseFormat, oauth_consumer_key, oauth_nonce, oauth_signature_method, oauth_timestamp, oauth_token, _
            oauth_version, Uri.EscapeDataString(screen_name), Uri.EscapeDataString(count), Uri.EscapeDataString(cursor))

        baseString = String.Concat("GET&", Uri.EscapeDataString(resource_url), "&", Uri.EscapeDataString(baseString))

        Dim compositeKey = String.Concat(Uri.EscapeDataString(oauth_consumer_secret), "&", Uri.EscapeDataString(oauth_token_secret))

        Dim oauth_signature As String
        Using hasher As New HMACSHA1(ASCIIEncoding.ASCII.GetBytes(compositeKey))
            oauth_signature = Convert.ToBase64String(hasher.ComputeHash(ASCIIEncoding.ASCII.GetBytes(baseString)))
        End Using

        ' create the request header
        Dim headerFormat = "OAuth oauth_nonce=""{0}"", oauth_signature_method=""{1}"", " + "oauth_timestamp=""{2}"", oauth_consumer_key=""{3}"", " + "oauth_token=""{4}"", oauth_signature=""{5}"", " + "oauth_version=""{6}"""

        Dim authHeader = String.Format(headerFormat, Uri.EscapeDataString(oauth_nonce), Uri.EscapeDataString(oauth_signature_method), Uri.EscapeDataString(oauth_timestamp), Uri.EscapeDataString(oauth_consumer_key), Uri.EscapeDataString(oauth_token), _
            Uri.EscapeDataString(oauth_signature), Uri.EscapeDataString(oauth_version))


        ' make the request

        ServicePointManager.Expect100Continue = False

        Dim postBody = "screen_name=" + Uri.EscapeDataString(screen_name)
        '
        Dim postbody2 = "count=" + Uri.EscapeDataString(count)
        resource_url += "?" + postBody + "&" + postbody2
        Dim request As HttpWebRequest = DirectCast(WebRequest.Create(resource_url), HttpWebRequest)
        request.Headers.Add("Authorization", authHeader)
        request.Method = "GET"
        request.ContentType = "application/x-www-form-urlencoded"


        Dim response As WebResponse = request.GetResponse()
        Dim responseData As String = New StreamReader(response.GetResponseStream()).ReadToEnd()


        RichTextBox1.Text = responseData

これは、カーソルの追加で得たものですが、運がありません..

Dim oauth_token = ""
Dim oauth_token_secret = ""
Dim oauth_consumer_key = ""
Dim oauth_consumer_secret = ""

' oauth implementation details
Dim oauth_version = "1.0"
Dim oauth_signature_method = "HMAC-SHA1"

' unique request details
Dim oauth_nonce = Convert.ToBase64String(New ASCIIEncoding().GetBytes(DateTime.Now.Ticks.ToString()))
Dim timeSpan = DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0, _
    0, DateTimeKind.Utc)
Dim oauth_timestamp = Convert.ToInt64(timeSpan.TotalSeconds).ToString()

' message api details
Dim status = "Updating status via REST API if this works"
Dim resource_url = "https://api.twitter.com/1.1/followers/ids.json"

Dim screen_name = "SimplyBenGenius"
Dim count = "5000"
Dim cursor = "-1"
' create oauth signature
Dim baseFormat = "count={7}&cursor={8}&oauth_consumer_key={0}&oauth_nonce={1}&oauth_signature_method={2}" + "&oauth_timestamp={3}&oauth_token={4}&oauth_version={5}&screen_name={6}" ''

Dim baseString = String.Format(baseFormat, oauth_consumer_key, oauth_nonce, oauth_signature_method, oauth_timestamp, oauth_token, _
    oauth_version, Uri.EscapeDataString(screen_name), Uri.EscapeDataString(count), Uri.EscapeDataString(cursor))

baseString = String.Concat("GET&", Uri.EscapeDataString(resource_url), "&", Uri.EscapeDataString(baseString))





Dim compositeKey = String.Concat(Uri.EscapeDataString(oauth_consumer_secret), "&", Uri.EscapeDataString(oauth_token_secret))

Dim oauth_signature As String
Using hasher As New HMACSHA1(ASCIIEncoding.ASCII.GetBytes(compositeKey))
    oauth_signature = Convert.ToBase64String(hasher.ComputeHash(ASCIIEncoding.ASCII.GetBytes(baseString)))
End Using

' create the request header
Dim headerFormat = "OAuth oauth_nonce=""{0}"", oauth_signature_method=""{1}"", " + "oauth_timestamp=""{2}"", oauth_consumer_key=""{3}"", " + "oauth_token=""{4}"", oauth_signature=""{5}"", " + "oauth_version=""{6}"""

Dim authHeader = String.Format(headerFormat, Uri.EscapeDataString(oauth_nonce), Uri.EscapeDataString(oauth_signature_method), Uri.EscapeDataString(oauth_timestamp), Uri.EscapeDataString(oauth_consumer_key), Uri.EscapeDataString(oauth_token), _
    Uri.EscapeDataString(oauth_signature), Uri.EscapeDataString(oauth_version))


' make the request

ServicePointManager.Expect100Continue = False

Dim postBody = "screen_name=" + Uri.EscapeDataString(screen_name)
'
Dim postbody2 = "count=" + Uri.EscapeDataString(count)
resource_url += "?" + postBody + "&" + postbody2
Dim request As HttpWebRequest = DirectCast(WebRequest.Create(resource_url), HttpWebRequest)
request.Headers.Add("Authorization", authHeader)
request.Method = "GET"
request.ContentType = "application/x-www-form-urlencoded"


Dim response As WebResponse = request.GetResponse()
Dim responseData As String = New StreamReader(response.GetResponseStream()).ReadToEnd()


RichTextBox1.Text += responseData

どんなアドバイスも素晴らしいでしょう、それは簡単な修正かもしれませんが、私はそれを見ることができないようです..

4

0 に答える 0