Posted 12 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.
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.
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();
}
}
}