Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- using Botting;
- namespace Botting
- {
- class GetAddresses
- {
- public string first, last, add, city, state, zip, phone;
- public bool failed;
- public List<string> adds;
- public GetAddresses(string state_, string last_, string first_ = "")
- {
- Init();
- state = state_;
- last = last_;
- first = first_;
- FindAddresses();
- }
- public void Init()
- {
- first = ""; last = "";
- add = ""; city = ""; state = ""; zip = "";
- phone = ""; adds = new List<string>(); failed = false;
- }
- /*
- GET http://www.addresses.com/ HTTP/1.1
- Accept: text/html, application/xhtml+xml, * / *
- <title>People Search
- First + last + state
- GET http://www.addresses.com/results.php?qf=John&qn=Smith&qloc=NY HTTP/1.1
- Accept: text/html, application/xhtml+xml, * / *
- Referer: http://www.addresses.com/
- Cookie: PHPSESSID=bb3ce96fa2eaee6dbf37ad0db3c03742; campaign=1-1KWVZd6kEQ9tQGVNVHFBNIkwRQyeQNVYWsn; ABTestCase_2=1-IgDVlFkJ0wWGQfBI9wT000AXVVYn4RFFGRfF5QcEB6Q; BIGipServerp-directory=420528394.20480.0000; __utma=40186866.1411263180.1516383885.1516383885.1516383885.1; __utmb=40186866.2.10.1516383885; __utmc=40186866; __utmz=40186866.1516383885.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); __utmt=1; __gads=ID=87a9bd17b547d053:T=1516383585:S=ALNI_MboEfHx4zPPskQkcwThRGA3tUeHfg; sbi_debug=false
- Location: /people/john+smith/ny
- First + state / Page 2
- GET http://www.addresses.com/people/smith/ny/p2 HTTP/1.1
- Accept: text/html, application/xhtml+xml, * / *
- Referer: http://www.addresses.com/people/smith/ny
- <div id="results_wp_outer" class="clearfix">
- <h2 class="wp_found_text">
- <span class="found_string">Found 61 Results for John Smith, NY</span>
- <span class="record_count">Showing page 1 of 7</span> <div class="clear"></div>
- </h2>
- <div id="results_wp_inner">
- <div class="wp_result even_listing first">
- <div class="clearfix">
- <div class="wp_result_details detail_column">
- <div class="wp_detail_name">
- <a href="/extredir/559850973/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/">John W Smith</a>
- </div>
- <div class="wp_detail_addr">
- <div class="listing_header">(770) 962-7381</div>
- <div class="listing_detail">207 E 15th ST</br>New York, NY 10003</div>
- <div class="view_more">
- <a href="/extredir/559850973/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/">View More »</a>
- </div>
- </div>
- </div>
- </div>
- <div class="wp_detail_links">
- <span class="listing_header">Get More Information: </span>
- <a href="/extredir/559850973/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/" title="">Detailed Background Report</a> |
- <a href="/extredir/4034367445/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/" title="">Email and Unlisted Phone Lookup</a> |
- <a href="/extredir/586468426/207/E+15th+St/John/W/Smith/New+York/NY/10003/207+E+15th+ST/7709627381/" title="">Property Report</a> |
- <a href="/people/john+smith/ny/3902486050" title="">Map</a>
- </div>
- </div>
- <div class="wp_result odd_listing">
- <div class="clearfix">
- <div class="wp_result_details detail_column">
- <div class="wp_detail_name">
- <a href="/extredir/559850973/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/">John J Smith</a>
- </div>
- <div class="wp_detail_addr">
- <div class="listing_header">(504) 834-1010</div>
- <div class="listing_detail">110 W State ST</br>Salamanca, NY 14779</div>
- <div class="view_more">
- <a href="/extredir/559850973/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/">View More »</a>
- </div>
- </div>
- </div>
- </div>
- <div class="wp_detail_links">
- <span class="listing_header">Get More Information: </span>
- <a href="/extredir/559850973/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/" title="">Detailed Background Report</a> |
- <a href="/extredir/4034367445/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/" title="">Email and Unlisted Phone Lookup</a> |
- <a href="/extredir/586468426/110/W+State+St/John/J/Smith/Salamanca/NY/14779/110+W+State+ST/5048341010/" title="">Property Report</a> |
- <a href="/people/john+smith/ny/1266975682" title="">Map</a>
- </div>
- </div>
- */
- public void FindAddresses()
- {
- failed = false;
- adds = new List<string>();
- Http http = new Http();
- http.Accept = "text/html, application/xhtml+xml, */*";
- http.KeepAlive = true;
- string url = "http://www.addresses.com/";
- string html = http.HttpGet(url);
- if (!html.Contains("<title>People Search"))
- {
- failed = true;
- return;
- }
- string refurl = url;
- url = "http://www.addresses.com/results.php?";
- if (first != "") { url += "qf=" + first + "&"; }
- url += "qn=" + last + "&qloc=" + state;
- http.KeepAlive = true;
- html = http.HttpGet(url, refurl);
- // <div class="wp_result_details detail_column"> -> <div class="view_more">
- int lc = 0;
- while (true)
- {
- lc++;
- if (lc > 50) { break; }
- Match m = Regex.Match(html, @"<div class=\""wp_result_details detail_column\"">(.*?)<div class=\""view_more\"">");
- if (!m.Success) { break; }
- string phtml = m.Result("$1");
- html = html.Substring((html.IndexOf(phtml) + phtml.Length));
- // <a href="/extredir/559850973/800/Westchester+Ave+%23ste+N405/John/A/Smith/Port+Chester/NY/10573/800+Westchester+AVE+STE+N405/9147010170/">John A Smith</a>
- m = Regex.Match(phtml, @"<a href=(.*?)<\/a>");
- if (!m.Success) { continue; }
- string nhtml = m.Result("$1");
- if (nhtml.Contains(">")) { nhtml = nhtml.Split('>')[(nhtml.Split('>').Count() - 1)]; }
- string fn = ""; string ln = "";
- if (nhtml.Contains(" "))
- {
- string[] narr = nhtml.Split(' ');
- if (narr.Count() != 3) { continue; }
- fn = narr[0];
- ln = narr[2];
- if (fn.Length < 3 || ln.Length < 3) { continue; }
- }
- else { continue; }
- // <div class="listing_detail">800 Westchester AVE #STE #N405</br>Port Chester, NY 10573</div>
- m = Regex.Match(phtml, @"<div class=\""listing_detail\"">(.*?)<\/div>");
- if (!m.Success) { continue; }
- string astr = m.Result("$1");
- if (!astr.Contains("</br>")) { continue; }
- astr = astr.Replace("</br>", "^");
- string[] aarr = astr.Split('^');
- string a1 = aarr[0];
- a1 = a1.Replace("#", "");
- astr = aarr[1];
- if (!astr.Contains(", ")) { continue; }
- astr = astr.Replace(", ", "^");
- aarr = astr.Split('^');
- string c1 = aarr[0];
- astr = aarr[1];
- if (!astr.Contains(" ")) { continue; }
- astr = astr.Replace(" ", "^");
- aarr = astr.Split('^');
- string s1 = aarr[0];
- string z1 = aarr[1];
- if (!a1.Contains(" ") || a1.Length < 6 || c1.Length < 3 || s1.Length != 2 ||
- z1.Length != 5)
- { continue; }
- astr = fn + "|" + ln + "|" + a1 + "|" + c1 + "|" + s1 + "|" + z1;
- adds.Add(astr);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement