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

Using Ruby to build Youtube Bot

Discussion in 'General Programming Chat' started by Getwithit, Jan 13, 2013.

  1. Getwithit

    Getwithit Newbie

    Joined:
    Oct 18, 2012
    Messages:
    5
    Likes Received:
    0
    I am trying to build a bot in ruby that extracts videos from a page, then uploads those videos to youtube by switching accounts and using different proxies. My knowledge extends to database structures in java for college. I am just looking for a mentor to guide me in the direction of what topics I need to know. For example switching proxies what is the technical term for that? I am searching ruby proxy alteration(a long with other keywords), but I am not getting too far. I just want to learn programming by actually making something and not just being directed by books. If you have a bot you don't have time to code but know the process behind it, I am willing to attempt to code it. Hope what I said makes some kind of sense. -Thanks

    note: so far I can scrape a page with regular expressions.
     
    Last edited: Jan 13, 2013
  2. sirgold

    sirgold Supreme Member

    Joined:
    Jun 25, 2010
    Messages:
    1,260
    Likes Received:
    646
    Occupation:
    Busy proving the Pareto principle right
    Location:
    A hot one
    Why do some ppl feel the urge to complicate their own lives with the latest buzzword trendy programming language out there? I mean what's the prize in terms of ROI? There are not even enough bindings to the GOOD PROVEN stuff to make bots in ruby. But hey if you wanna hurt yourself you can try with selenium, maybe: http://code.google.com/p/selenium/wiki/RubyBindings
     
    • Thanks Thanks x 1
  3. Getwithit

    Getwithit Newbie

    Joined:
    Oct 18, 2012
    Messages:
    5
    Likes Received:
    0
    Thanks! I should probably put in more consideration about which language I am learning/using. Especially when knowing only a basic amount of java, I could be setting myself up for failure. I heard ruby looks good by its appearance but when it comes down to the c it is written in there are a lot of flaws. I just do not currently know enough to make a good decision. I just know I want to get a programming job(not career) just to pick other coders brains and see how the business works. Seems like rails currently has a high demand and you do not need a lot of coding experience. So based off that is my lame excuse of why I am using this language to learn how to code.
     
  4. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,479
    Likes Received:
    10,232
    If you want to gain experience for a specific reason, you should try to work on projects that are close to that reason.

    For example, if your goal is to make stuff for the IM crowd, learning by building a bot is a good idea. If your goal is geared towards web site creation, it 's not.

    Now, on how to make a bot. First thing to realize is that what a bot does is to emulate a process. Then you study the process by the use of your toolset.

    For example, let 's say we want to make a scraping bot for Google search. The process is that we need to query Google 's web server with specific parameters, grab the output, and parse it. That 's it. Break it down into pieces and start building them with your tools (e.g. how do I query G 's servers? http requests - what tool do I have to work on that?).

    As you start building all those small parts of your bot, issues will appear but that 's ok. Deal with them in theit own time. For example, Google will ban your ip if you do many requests - how do I solve it? Proxies. How do I use proxies on my http requests with my tools?

    And so we come to your question: how do I switch proxies? Well, isn't it obvious now? The answer depends on the tools you use.
     
    • Thanks Thanks x 2
  5. Getwithit

    Getwithit Newbie

    Joined:
    Oct 18, 2012
    Messages:
    5
    Likes Received:
    0
    Right on Jazzc. Totally makes sense. Thank you so much for the input! "use proxies on my http requests" were the keywords I was looking for. Ruby I am trying to learn for web development, but I had the assumption using it for the bot wouldn't be difficult. So I thought why not learn the syntax get used to the language while making a bot. Apparently that was a poor assumption. This is definitely going to be a challenge for me but I know I will be able to figure it out. The programs we completed in school were lame.
     
  6. cash202

    cash202 Elite Member Premium Member

    Joined:
    Mar 12, 2011
    Messages:
    1,803
    Likes Received:
    2,818
    Location:
    Sydney, Australia
    Home Page:
    Sorry, but Ruby and Rails are shit. They are hip, no questions but this shit doesn't scale well. Guess why Twitter switches from RoR to Java platform (they use Scala)? Go with Groovy/Grails. Similar to RoR and you can use your existing Java skill and all Java libraries.

    You'll be doing a lot of mental masturbation to do in Ruby something that takes a couple of days to do in Java (or Groovy to script faster) with JSoup for HTML scraping and Selenium for web bots (with all the proxy support you need).
     
    • Thanks Thanks x 1
  7. Getwithit

    Getwithit Newbie

    Joined:
    Oct 18, 2012
    Messages:
    5
    Likes Received:
    0
    Alright sounds cool. Thanks for the heads up. I recently had a talk with a kid that just graduated from Harvard. He didn't directly say rails sucks but he made sure to mention twitter switching to scala in the same discussion. That right there made me feel like I was going in the wrong direction, then this post kind of confirmed it. Anyone on here have anything good to say about ruby that codes with it?
     
  8. zyx2000

    zyx2000 Registered Member

    Joined:
    May 6, 2011
    Messages:
    56
    Likes Received:
    7
    Actually Ruby is faster than Groovy. Don't take my word for it, Google some performance comparisons.

    You can run Ruby on the JVM thanks to JRuby and thus call Java libraries.

    It takes far less code to do things in Ruby compared to Java.

    Have you actually tried Ruby? I program both.

    As for the bot stuff, check Watir-Webdriver for instance.
     
  9. s0ap

    s0ap Executive VIP Jr. VIP Premium Member

    Joined:
    Sep 23, 2008
    Messages:
    230
    Likes Received:
    813
    Occupation:
    :] guess
    Location:
    Congo/DRC
    Java is a steaming pile of shit. Always has been, always will be. And unless you are sitting on a really fat pipe all of your latency is going to come from wait states in the TCP/IP stack, not from the language you are using.

    Don't get too caught up in the latest hipster bindings/libraries/extensions/whatever as there will always be poor coders out there who feel that they need to reinvent the wheel and market it to other poor coders. Just pick a language and use it until you actually find the limitations for yourself.
     
    • Thanks Thanks x 1