Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.37 KB | None | 0 0
  1. using Newtonsoft.Json.Linq;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Text.RegularExpressions;
  11. using System.Threading;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14.  
  15. namespace InstaStealer
  16. {
  17.     public partial class Form1 : Form
  18.     {
  19.         public Form1()
  20.         {
  21.             InitializeComponent();
  22.             radioButton1.Checked = true;
  23.         }
  24.  
  25.         public static string[] richToArray(RichTextBox textBox)
  26.         {
  27.             string[] lines = textBox.Text.Split(new char[] { '\r', '\n', '|', ' ' }, StringSplitOptions.RemoveEmptyEntries);
  28.             string[] array = new string[lines.Length];
  29.  
  30.             for (int i = 0; i < array.Length; i++)
  31.             {
  32.                 array[i] = lines[i];
  33.             }
  34.  
  35.             return array;
  36.         }
  37.  
  38.         public static int getID(string domain)
  39.         {
  40.             try
  41.             {
  42.                 //string query = Request.GET("http://127.0.0.1/api.php?act=id.get&nick=ykshv" + domain);
  43.                 //string matches = Regex.Match(query, "(?<=\"id\":\")(.*)(},\"moreAvailable)").ToString();
  44.                 //MessageBox.Show(matches);
  45.                 //return Convert.ToInt32(matches.Split('"')[0]);
  46.                 string query = Request.GET("http://127.0.0.1/api.php?act=id.get&nick=" + domain);
  47.                 return Convert.ToInt32(query);
  48.  
  49.             }
  50.             catch
  51.             {
  52.                 return 0;
  53.             }
  54.            
  55.         }
  56.         private void button1_Click(object sender, EventArgs e)
  57.         {
  58.             Config.token = "319636406.2e72465.ceece79a63054b8a908012717e76ad2a";
  59.             Thread start = new Thread(Start);
  60.             start.Start();
  61.         }
  62.  
  63.         private void Logger(string text)
  64.         {
  65.             BeginInvoke(new MethodInvoker(delegate
  66.             {
  67.                 richTextBox4.AppendText(text + Environment.NewLine);
  68.             }));
  69.         }
  70.         private void Start()
  71.         {
  72.             BeginInvoke(new MethodInvoker(delegate
  73.             {
  74.                 string[] accounts = richToArray(richTextBox3);
  75.  
  76.                 foreach (string account in accounts)
  77.                 {
  78.                     Logger("Account: " + account);
  79.                     Logger("Getting ID...");
  80.  
  81.                     int id = getID(account);
  82.  
  83.                     Logger("ID: " + id);
  84.                     Logger("Get last likes...");
  85.  
  86.                     getLastLiked(id);
  87.                 }
  88.             }));
  89.         }
  90.  
  91.         public void getLastLiked(int id)
  92.         {
  93.             string query = Api.Query("users/" + id.ToString() + "/media/recent");
  94.             RootObject json = JsonConvert.DeserializeObject<RootObject>(query);
  95.  
  96.             string result = string.Empty;
  97.  
  98.             for(int i = 0; i < 4; i++)
  99.             {
  100.                 foreach (Datum2 datum2 in json.data[i].likes.data)
  101.                 {
  102.                     result += datum2.username + ",";
  103.                 }
  104.             }
  105.  
  106.             string[] users = result.Substring(0, result.Length - 1).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  107.  
  108.             foreach(string user in users)
  109.             {
  110.                 Logger(user);
  111.             }
  112.         }
  113.     }
  114.  
  115.     public class Pagination
  116.     {
  117.         public string next_url { get; set; }
  118.         public string next_max_id { get; set; }
  119.     }
  120.  
  121.     public class Meta
  122.     {
  123.         public int code { get; set; }
  124.     }
  125.  
  126.     public class Location
  127.     {
  128.         public double latitude { get; set; }
  129.         public string name { get; set; }
  130.         public double longitude { get; set; }
  131.         public int id { get; set; }
  132.     }
  133.  
  134.     public class Comments
  135.     {
  136.         public int count { get; set; }
  137.         public List<object> data { get; set; }
  138.     }
  139.  
  140.     public class Datum2
  141.     {
  142.         public string username { get; set; }
  143.         public string profile_picture { get; set; }
  144.         public string id { get; set; }
  145.         public string full_name { get; set; }
  146.     }
  147.  
  148.     public class Likes
  149.     {
  150.         public int count { get; set; }
  151.         public List<Datum2> data { get; set; }
  152.     }
  153.  
  154.     public class LowResolution
  155.     {
  156.         public string url { get; set; }
  157.         public int width { get; set; }
  158.         public int height { get; set; }
  159.     }
  160.  
  161.     public class Thumbnail
  162.     {
  163.         public string url { get; set; }
  164.         public int width { get; set; }
  165.         public int height { get; set; }
  166.     }
  167.  
  168.     public class StandardResolution
  169.     {
  170.         public string url { get; set; }
  171.         public int width { get; set; }
  172.         public int height { get; set; }
  173.     }
  174.  
  175.     public class Images
  176.     {
  177.         public LowResolution low_resolution { get; set; }
  178.         public Thumbnail thumbnail { get; set; }
  179.         public StandardResolution standard_resolution { get; set; }
  180.     }
  181.  
  182.     public class From
  183.     {
  184.         public string username { get; set; }
  185.         public string profile_picture { get; set; }
  186.         public string id { get; set; }
  187.         public string full_name { get; set; }
  188.     }
  189.  
  190.     public class Caption
  191.     {
  192.         public string created_time { get; set; }
  193.         public string text { get; set; }
  194.         public From from { get; set; }
  195.         public string id { get; set; }
  196.     }
  197.  
  198.     public class User
  199.     {
  200.         public string username { get; set; }
  201.         public string website { get; set; }
  202.         public string profile_picture { get; set; }
  203.         public string full_name { get; set; }
  204.         public string bio { get; set; }
  205.         public string id { get; set; }
  206.     }
  207.  
  208.     public class LowBandwidth
  209.     {
  210.         public string url { get; set; }
  211.         public int width { get; set; }
  212.         public int height { get; set; }
  213.     }
  214.  
  215.     public class StandardResolution2
  216.     {
  217.         public string url { get; set; }
  218.         public int width { get; set; }
  219.         public int height { get; set; }
  220.     }
  221.  
  222.     public class LowResolution2
  223.     {
  224.         public string url { get; set; }
  225.         public int width { get; set; }
  226.         public int height { get; set; }
  227.     }
  228.  
  229.     public class Videos
  230.     {
  231.         public LowBandwidth low_bandwidth { get; set; }
  232.         public StandardResolution2 standard_resolution { get; set; }
  233.         public LowResolution2 low_resolution { get; set; }
  234.     }
  235.  
  236.     public class Datum
  237.     {
  238.         public object attribution { get; set; }
  239.         public List<object> tags { get; set; }
  240.         public string type { get; set; }
  241.         public Location location { get; set; }
  242.         public Comments comments { get; set; }
  243.         public string filter { get; set; }
  244.         public string created_time { get; set; }
  245.         public string link { get; set; }
  246.         public Likes likes { get; set; }
  247.         public Images images { get; set; }
  248.         public List<object> users_in_photo { get; set; }
  249.         public Caption caption { get; set; }
  250.         public bool user_has_liked { get; set; }
  251.         public string id { get; set; }
  252.         public User user { get; set; }
  253.         public Videos videos { get; set; }
  254.     }
  255.  
  256.     public class RootObject
  257.     {
  258.         public Pagination pagination { get; set; }
  259.         public Meta meta { get; set; }
  260.         public List<Datum> data { get; set; }
  261.     }
  262. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement