[C#] Imvu Avatar Url Grabber

DataMine
by DataMine · 4 posts
11 years ago in .Net (C#, VB, etc)
Posted 11 years ago · Author
This is a program I wrote to build lists of avatar homepage urls for use with my sticker grabber found here: viewtopic.php?f=109&t=8536

It will go to the find people page and start on whatever page you tell it to and pull out all the avatar homepage urls on each page and output them to a file. It supports logging in so you can gather ap urls. Unfortunately, my sticker grabber does not support logging in yet so you can't rip ap homepages with it yet but I plan on adding that ability when I can.

See my Free IDES thread if you need an IDE to build this program with: https://www.imvumafias.org/community/vie ... 109&t=8525

You need the HtmlAgilityPack library to use this, you can grab it at the bottom of this post.

Code
using System;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;

namespace Imvu_Avatar_Name_Grabber
{
   class Program
   {
      public static string a = "";
      public static string avi = "";
      public static string pass = "";
      public static CookieContainer logincookie = default(CookieContainer);
      public static string page = "";
      public static int i = 1;
      
      public static void Main(string[] args)
      {
         Console.Title = "IMVU Avatar Name Grabber";
            Console.ForegroundColor = ConsoleColor.Red;
           
            Console.WriteLine("Would you like to login?");
            Console.WriteLine("========================");
            Console.WriteLine("");
            Console.WriteLine("1 - Yes");
            Console.WriteLine("2 - No");
            Console.WriteLine("");
            Console.WriteLine("Press select a number:");
            Console.WriteLine("");
            a = Console.ReadLine();
            switch (a)
            {
               case "1":
                  Console.Clear();
                  Console.WriteLine("Type in your avi name");
                  Console.WriteLine("");
                  avi = Console.ReadLine();
                  Console.WriteLine("");
                  Console.WriteLine("Type in your password");
                  Console.WriteLine("");
                  pass = Console.ReadLine();
                  login();
                  break;
               case "2":
                  avi_n();
                  break;
               default:
                  break;
            }
      }
      
      public static void login()
      {
         string postData = "POSTDATA=sauce=&avatarname=" + avi + "&" + "password=" + pass + "&password_strength=strong&sendto=";
         CookieContainer tempCookies = new CookieContainer();
         UTF8Encoding encoding = new UTF8Encoding();
         byte[] byteData = encoding.GetBytes(postData);
         
         HttpWebRequest postReq = (HttpWebRequest)WebRequest.Create("https://secure.imvu.com/login/login/");
         postReq.Method = "POST";
         postReq.KeepAlive = true;
         postReq.CookieContainer = tempCookies;
         postReq.ContentType = "application/x-www-form-urlencoded";
         postReq.Referer = "http://www.imvu.com/login/";
         postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1";
         postReq.ContentLength = byteData.Length;
         
         Stream postreqstream = postReq.GetRequestStream();
         postreqstream.Write(byteData, 0, byteData.Length);
         postreqstream.Close();
         HttpWebResponse postresponse = default(HttpWebResponse);
         
         postresponse = (HttpWebResponse)postReq.GetResponse();
         tempCookies.Add(postresponse.Cookies);
         logincookie = tempCookies;
         StreamReader postreqreader = new StreamReader(postresponse.GetResponseStream());
         
         string thepage = postreqreader.ReadToEnd();   
         if (thepage.Contains("<title>My IMVU</title>"))
         {
            Console.Clear();
            Console.WriteLine("Successfully logged in as " + avi);
         }
         Console.WriteLine("");
         Console.WriteLine("Press enter to continue");
         Console.ReadLine();
         avi_n();
      }
      
      public static void avi_n()
      {
         FileStream ostrm;
            StreamWriter writer;
            TextWriter oldOut = Console.Out;
            ostrm = new FileStream ("Avi_urls.txt", FileMode.OpenOrCreate, FileAccess.Write);
            writer = new StreamWriter (ostrm);
         
         Console.Clear();
         Console.WriteLine("What page would you like to start on? (Leave blank for 1)");
         Console.WriteLine("");
         page = Console.ReadLine();
         if (page == "")
         {
            page = "1";
         }
         i = Convert.ToInt32(page);
   
         Console.Clear();
         do
         {
            Console.WriteLine("Starting grab on page " + i);
            Console.WriteLine("");
                     
            HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://www.imvu.com/people/search.php?page=" + i);
            myReq.CookieContainer = logincookie;
            HttpWebResponse HttpWResp = (HttpWebResponse)myReq.GetResponse();
               System.IO.StreamReader page_src = new System.IO.StreamReader(HttpWResp.GetResponseStream());
               string f_p = page_src.ReadToEnd();

               System.Text.RegularExpressions.Regex url = new System.Text.RegularExpressions.Regex("<a href=\"http:\\/\\/avatars\\.imvu\\.com\\/.*\">", RegexOptions.IgnoreCase);
               MatchCollection matches = url.Matches(f_p);
               foreach (Match avi_html in matches)
               {
                  string[] data = avi_html.Value.Split(new[] { @"""" }, StringSplitOptions.None);
                  string avi_url = data[1];
                  Console.WriteLine(avi_url);
                  Console.SetOut (writer);
                  Console.WriteLine(avi_url);
                   Console.SetOut (oldOut);
               }
               ++i;
               Console.WriteLine("");
         } while (i < 99999);
            Console.WriteLine("Done");
            Console.ReadLine();
      }
   }
}
Posted 11 years ago
Glad to see this up and running aswell. I might tinker with it and give it a GUI if I get around to it!
Posted 11 years ago · Author
Don Von Free Credits wrote:
This would be useful if it accepted lists of names and checked for a list of names. It would make intel so much easier.


The whole point of this tool was to build me a list of avatar homepage urls I could input into my sticker downloader.

I am not quite sure you want it to do? This tool doesn't have a reason to accept input other than login information and page number. What would you want it to do with the names you give it? Convert them to homepage links? If you want to do that then use the Imvu converter I made.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT
Select a forum Protection     Help & Support     Introductions     Mafia News     IMVU News General Discussion     IMVU Lounge        IMVU Series / Roleplaying        Social Games     Mafia Market     Mafia Tools        Premium IMVU Tools        Off Topic Tools     Off Topic     Contests Creator Corner     Graphics Design        Photoshop        GIMP     Basic Creator Help     Catalog And Product Showcase     3D Meshing        3Ds Max        Sketchup        Blender Gangsters with Connections     White Hat Activities        Google Hacking        Trackers Programming Corner     Coding        Python        .Net (C#, VB, etc)        Flash        JAVA        Autoit        Batch        HTML & CSS        Javascript        PHP        Other        IMVU Homepage Codes           General           About me Panel           Messages Panel           Special Someone Panel           Visitors Panel           New Products Panel           Rankings Panel           Wishlist Panel           My Badges Panel           Outfits Panel           Url Panel           Groups Panel           Slideshow Panel           My Room Panel           Sandbox panel           Layouts     Help & Requests Free Credits     Approved Methods     Submit Methods Free Money     Approved Methods     Submit Methods Adult Corner     Get Mafia AP Here     AP Lounge        AP Social Games        Casual Dating Tips     IMVU Slave Market & Escorts