5bub

Send Dm

Jan 24th, 2020
3,183
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'By @5bub | متبري من ذنوبكم
  2.  Public Function send(cookie As CookieContainer, id As String, msg As String) As Object
  3.  
  4.         Try
  5.             Dim r As New Random
  6.             Dim ran As String = r.Next(1000, 9999).ToString
  7.             Dim uuid As String = Guid.NewGuid().ToString()
  8.  
  9.             Dim postdata As String = $"recipient_users=[[{Id}]]&mentioned_user_ids=[]&action=send_item&client_context=35c762b8-{ran}-{ran}-a199-0fa0203d639d&_csrftoken=loNSxHSbYdWiXdFRw5qEeydA9yQ7tBUj&text={msg}&device_id={uuid}&mutation_token=35c762b8-{ran}-{ran}-a199-0fa0203d639d&_uuid={uuid}"
  10.             Dim bytes As Byte() = Encoding.UTF8.GetBytes(postdata)
  11.             Dim request As HttpWebRequest = CType(WebRequest.Create("https://i.instagram.com/api/v1/direct_v2/threads/broadcast/text/"), HttpWebRequest)
  12.             With request
  13.  
  14. 'By @5bub | متبري من ذنوبكم
  15.  
  16.                 .Method = "POST"
  17.                 .Host = "i.instagram.com"
  18.                 .UserAgent = "Instagram 22.0.0.15.68 Android (24/5.0; 515dpi; 1440x2416; huawei/google; Nexus 6P; angler; angler; en_US)"
  19.                 .Headers.Add("Accept-Language", "ar;q=1, en;q=0.9")
  20.                 .KeepAlive = True
  21.                 .Proxy = Nothing
  22.                 .ContentType = " application/x-www-form-urlencoded; charset=UTF-8"
  23.                 .ContentLength = CLng(bytes.Length)
  24.                 .CookieContainer = cookie
  25.  
  26. 'By @5bub | متبري من ذنوبكم
  27.  
  28.             End With
  29.             Dim requestStream As Stream = request.GetRequestStream()
  30.             requestStream.Write(bytes, 0, bytes.Length)
  31.             requestStream.Close()
  32.             Dim res As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
  33.             Using streamReader As StreamReader = New StreamReader(res.GetResponseStream())
  34.                 If streamReader.ReadToEnd().Contains("{""status"": ""ok""}") Then
  35.                     Return True
  36.  
  37.                 End If
  38.                 streamReader.Close()
  39.             End Using
  40.             res.Close()
  41.         Catch ex As Exception
  42.         End Try
  43.  
  44. 'By @5bub | متبري من ذنوبكم
  45.  
  46.         Return False
  47.     End Function
RAW Paste Data