Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6939821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:40:19+00:00 2026-05-27T12:40:19+00:00

Here’s my problem: I was asked to develop a script that grabs the percentage

  • 0

Here’s my problem: I was asked to develop a script that grabs the percentage of votes a certain artist has on Q102’s Jingle Ball page, parses it and tweets the current percentage, along with the name of the artist. The API to tweet is done in AppleScript and it already tweets a custom string I pass to it. The only thing I need now is to get the values to build the string.

Now, I tried doing a simple curl like this via Terminal:

curl http://www.q102.com/pages/jb-brackets/

The problem is, in any poll, it doesn’t even get the input types when I curl (they’re radio buttons if you visit the page and try and vote), it just shows this for an artist when I curl’ed it (each poll has a specific ID – this is the poll that contains the data I need to get).

    <tr>
    <td rowspan="3" class="poll-left"><p><b>Demi Lovato vs. <br>
      Avril Lavigne</b></p> 

<div id="start_poll_203988"></div>
<div id="poll_203988"></div>
<div id="stop_poll_203988">
<script language="javascript">
//<![CDATA[
 insertPoll2('203988');


//]]>
</script>

When you vote for a certain artist, and press ‘Vote’, it shows you the current percentage of votes, like so:

Demi Lovato vs.
Avril Lavigne

Demi Lovato
49.88 %

Avril Lavigne
50.12 %

What I need to do is submit a vote, and get the value, because the stats only show up AFTER I submit the vote (on the main page). The page doesn’t refresh after you vote. Basically, all I need is ‘49.88%’ and ‘50.12%’ (these stats vary, obviously).

Is there any way to do this with curl/something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:40:20+00:00Added an answer on May 27, 2026 at 12:40 pm

    Since you are working with JavaScript you have two options. Analyzing the JS to see what it’s doing then sending those requests manually or you need to control an app that supports JS – a web browser.

    Look here for info on the first option : https://stackoverflow.com/a/8304040/991805

    As for the second, given what I know, I was able to get it to work using Firefox controlled by Ruby.

    require 'rubygems'
    require 'watir-webdriver'
    require 'nokogiri'
    
    browser = Watir::Browser.new
    browser.goto('http://www.q102.com/pages/jb-brackets/')
    browser.radios[-1].focus
    
    (browser.radios.length / 2).times do |i|
      browser.radios[1].set
      browser.buttons[1].click
      browser.radios[0].focus
      sleep 0.5
    end
    
    temp = []
    source = Nokogiri::HTML(browser.html)
    source.css('.brackets tbody tr td div tbody table tbody tr td').each {|a| temp << a.text.strip!}
    
    browser.close
    puts temp
    

    This will output :

    Big Time Rush
    55.15 %
    Flo Rida
    44.85 %
    Lady GaGa
    44.22 %
    Kelly Clarkson
    55.78 %
    Demi Lovato
    50.19 %
    Avril Lavigne
    49.81 %
    Justin Bieber
    48.26 %
    Train
    51.74 %
    David Archuleta
    45.92 %
    Jordin Sparks
    54.08 %
    Adam Lambert
    53.56 %
    Pitbull
    46.44 %
    Joe Jonas
    54.16 %
    All Time Low
    45.84 %
    Selena Gomez
    50.37 %
    Katy Perry
    49.63 %
    

    This script works on Mac and needs the two following gems (libraries) to run : watir-webdriver and Nokogori. As well as Firefox.

    Check that Ruby is installed ruby -v
    Check that gem is installed gem -v
    Install the libraries gem install watir-webdriver nokogiri
    Run the script ruby ratings.rb

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a coding problem for those that like this kind of thing. Let's see
Here is another spoj problem that asks how to find the number of distinct
Here is my problem...I have a page that loads a list of clients and
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is the scenario: I'm writing an app that will watch for any changes
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.