1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'C, C++, C#' started by unclelany, May 19, 2014.

  1. unclelany

    unclelany Newbie

    Joined:
    Feb 11, 2010
    Messages:
    6
    Likes Received:
    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
     
  2. Recharge

    Recharge Newbie

    Joined:
    Jun 6, 2014
    Messages:
    3
    Likes Received:
    1
    Occupation:
    PHP/JS/C# Developer
    Location:
    Crypto-land.
    Are you using C# Web Browser control or WebRequests class to achieve this?
     
  3. DarkPixel

    DarkPixel Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 4, 2011
    Messages:
    1,328
    Likes Received:
    1,239
    Location:
    ↓↓↓↓
    Home Page:
    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.
     
    • Thanks Thanks x 2
  4. Piotr__11

    Piotr__11 Junior Member

    Joined:
    Mar 13, 2012
    Messages:
    122
    Likes Received:
    69
    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()
     
    • Thanks Thanks x 4
  5. opahopa

    opahopa Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 23, 2012
    Messages:
    142
    Likes Received:
    9
    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);
     
  6. jimbobo2779

    jimbobo2779 Jr. VIP Jr. VIP Premium Member

    Joined:
    Sep 17, 2008
    Messages:
    3,245
    Likes Received:
    2,396
    Occupation:
    Software Engineer
    Location:
    UK
    Home Page:
    Why have you resurrected an ancient account to bump ancient threads? Looks incredibly dodgy.
     
  7. Css14

    Css14 Newbie

    Joined:
    Sep 22, 2014
    Messages:
    14
    Likes Received:
    2
    Nice trick! :cool:
     
  8. futureman89

    futureman89 Newbie

    Joined:
    Mar 15, 2016
    Messages:
    4
    Likes Received:
    0
    Home Page:
    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