[C#][Help]How to click random url from a page

unclelany

Newbie
Joined
Feb 11, 2010
Messages
6
Reaction score
1
Have already created a bot with proxy support and it does works well, but i plan to advanced it more further by randomly clicking any url within that domain on a fix/random time interval. Is their any way i can achieve this
 
Are you using C# Web Browser control or WebRequests class to achieve this?
 
The general idea is the same if you use webrequests or browser. Save all the links (hrefs) to a string array, and pick a random URL from your array. Then visit that url.

With a browser control you can also use javascript to do that.
 
If it's a webbrowser u can use Document.getelementbytagname and then getattribute method.
On webrequest of course you need to fetch all links and then apply some randomizer.

May be helpfull:
public static List<string> SplitElemetToListByBoundary(string src, string startString, string stopString) {
string str1 = Regex.Escape(startString);
string str2 = Regex.Escape(stopString);
return Enumerable.ToList<string>(Enumerable.Select<System.Text.RegularExpressions.Match, string>(Enumerable.Cast<System.Text.RegularExpressions.Match>((IEnumerable) Regex.Matches(src, str1 + ".*?" + str2)), (Func<System.Text.RegularExpressions.Match, string>) (s => s.Value.Replace(startString, "").Replace(stopString, ""))));
}


U can split by http to "\"" and then apply .Select(e=> "http" + e ).ToList()
 
if u`re using webrecuests, you need to take the content of page, extract the links(most useful way - regular expressions) -> put the links to array/list or whatever you want and just take the random like string url = new Random r.Next(0, url_list.lengh);
 
if u`re using webrecuests, you need to take the content of page, extract the links(most useful way - regular expressions) -> put the links to array/list or whatever you want and just take the random like string url = new Random r.Next(0, url_list.lengh);

Why have you resurrected an ancient account to bump ancient threads? Looks incredibly dodgy.
 
If it's a webbrowser u can use Document.getelementbytagname and then getattribute method.
On webrequest of course you need to fetch all links and then apply some randomizer.

May be helpfull:



U can split by http to "\"" and then apply .Select(e=> "http" + e ).ToList()

Nice trick! :cool:
 
You can read all html in your website, get all <a> tag. Pick random href and go to this url
Using HtmlAgilityPack.dll to read html in website
 
Back
Top