Jump to content
UBot Underground

Stuck And Need Help


Recommended Posts

I have a webpage that I'm trying to scrape the multiple dates listed in a drop down on a web page.

 

I have tried to use scrape attribute to get the dates and I have been able to do that but it actually pulls in

the list twice instead of once. So I then went to try and scrape the page and I can't figure this out for the life

of me.

 

This is what the html of that drop down looks like:

<select name="fenddate"><option value="0">-</option><option value="2013-07-23">2013-07-23</option><option value="2013-07-24" selected="selected">2013-07-24 (16616)</option><option value="2013-07-25">2013-07-25 (18812)</option><option value="2013-07-26">2013-07-26 (19446)</option><option value="2013-07-27">2013-07-27 (15781)</option><option value="2013-07-28">2013-07-28 (14578)</option><option value="2013-07-29">2013-07-29 (16213)</option><option value="2013-07-30">2013-07-30 (17898)</option><option value="2013-07-31">2013-07-31 (15733)</option><option value="2013-08-01">2013-08-01 (19123)</option><option value="2013-08-02">2013-08-02 (17264)</option><option value="2013-08-03">2013-08-03 (14857)</option><option value="2013-08-04">2013-08-04 (13243)</option><option value="2013-08-05">2013-08-05 (15079)</option><option value="2013-08-06">2013-08-06 (15120)</option><option value="2013-08-07">2013-08-07 (12314)</option><option value="2013-08-08">2013-08-08 (15000)</option><option value="2013-08-09">2013-08-09 (17077)</option><option value="2013-08-10">2013-08-10 (4092)</option><option value="2013-08-11">2013-08-11 (2911)</option><option value="2013-08-12">2013-08-12 (2945)</option><option value="2013-08-13">2013-08-13 (3039)</option><option value="2013-08-14">2013-08-14 (2721)</option><option value="2013-08-15">2013-08-15 (3251)</option><option value="2013-08-16">2013-08-16 (2817)</option><option value="2013-08-17">2013-08-17 (3001)</option><option value="2013-08-18">2013-08-18 (3014)</option><option value="2013-08-19">2013-08-19 (707)</option><option value="2013-08-20">2013-08-20 (476)</option><option value="2013-08-21">2013-08-21 (538)</option><option value="2013-08-22">2013-08-22 (672)</option></select> End Date<br>

These dates change daily so I'm having a tough time with it.

 

Any ideas?

Link to post
Share on other sites

So first off I have to thank HelloInsomnia because I bought his Regex Builder and

I was able to get what I need from that...its not everything but it's more than I had

before the bot so I'm really excited.

I was able to pull the data with this regex:

 

\d+\-\d+\-\d+\s\(\d+\)

 

That left me with a list like this:

2013-07-24 (16616)
2013-07-25 (18812)
2013-07-26 (19446)
2013-07-27 (15781)
2013-07-28 (14578)
2013-07-29 (16213)
2013-07-30 (17898)
2013-07-31 (15733)
2013-08-01 (19123)
2013-08-02 (17264)
2013-08-03 (14857)
2013-08-04 (13243)
2013-08-05 (15079)
2013-08-06 (15120)
2013-08-07 (12314)
2013-08-08 (15000)
2013-08-09 (17077)
2013-08-10 (4092)
2013-08-11 (2911)
2013-08-12 (2945)
2013-08-13 (3039)
2013-08-14 (2721)
2013-08-15 (3251)
2013-08-16 (2817)
2013-08-17 (3001)
2013-08-18 (3014)
2013-08-19 (707)
2013-08-20 (476)
2013-08-21 (538)
2013-08-22 (672)

Now there is two different choices I can't figure out just yet. One is there is a choice that just has a "-" without the quotes which tells the bot to pull

everything instead of a single date...

 

and the other issue is that there is also a choice without the space and the brackets with numbers in them like this 2013-07-23 and I can't pull that

yet.

 

Any ideas on how to pull the other two and keep the ones I'm already getting?

Link to post
Share on other sites

set(#var"<select name=\"fenddate\"><option value=\"0\">-</option><option value=\"2013-07-23\">2013-07-23</option><option value=\"2013-07-24\" selected=\"selected\">2013-07-24 (16616)</option><option value=\"2013-07-25\">2013-07-25 (18812)</option><option value=\"2013-07-26\">2013-07-26 (19446)</option><option value=\"2013-07-27\">2013-07-27 (15781)</option><option value=\"2013-07-28\">2013-07-28 (14578)</option><option value=\"2013-07-29\">2013-07-29 (16213)</option><option value=\"2013-07-30\">2013-07-30 (17898)</option><option value=\"2013-07-31\">2013-07-31 (15733)</option><option value=\"2013-08-01\">2013-08-01 (19123)</option><option value=\"2013-08-02\">2013-08-02 (17264)</option><option value=\"2013-08-03\">2013-08-03 (14857)</option><option value=\"2013-08-04\">2013-08-04 (13243)</option><option value=\"2013-08-05\">2013-08-05 (15079)</option><option value=\"2013-08-06\">2013-08-06 (15120)</option><option value=\"2013-08-07\">2013-08-07 (12314)</option><option value=\"2013-08-08\">2013-08-08 (15000)</option><option value=\"2013-08-09\">2013-08-09 (17077)</option><option value=\"2013-08-10\">2013-08-10 (4092)</option><option value=\"2013-08-11\">2013-08-11 (2911)</option><option value=\"2013-08-12\">2013-08-12 (2945)</option><option value=\"2013-08-13\">2013-08-13 (3039)</option><option value=\"2013-08-14\">2013-08-14 (2721)</option><option value=\"2013-08-15\">2013-08-15 (3251)</option><option value=\"2013-08-16\">2013-08-16 (2817)</option><option value=\"2013-08-17\">2013-08-17 (3001)</option><option value=\"2013-08-18\">2013-08-18 (3014)</option><option value=\"2013-08-19\">2013-08-19 (707)</option><option value=\"2013-08-20\">2013-08-20 (476)</option><option value=\"2013-08-21\">2013-08-21 (538)</option><option value=\"2013-08-22\">2013-08-22 (672)</option></select> End Date<br>""Global")
add list to list(%values$list from text($replace($find regular expression(#var"(?=\">).*?(?=</option>)"), "\">"""), $new line), "Delete""Global")
remove from list(%values, 0)
load html($replace(%values$new line"<BR>"))

Link to post
Share on other sites

I haven't tried your code LoWrIdErTJ because you're adding them as a static choice

when these values update dynamically daily and change daily. I need something that

can scrape the values and then add them to a UI drop down dynamically.

Link to post
Share on other sites

the above will do that..

 

its scraping the innertext of each possible option

 

its the same way i populate a drop down

 

in your dropdown use
$replace($list name, $new line, ",")

 

that will take the list, and convert it to comma delimited to separate them as indivigual list items in your drop down to select.

Link to post
Share on other sites

Where is it scraping anything? You're setting the variable as static choices?

 

The values I need are pulled from scraping the drop down on a webpage where

the values are dynamic and change daily. I can't see how your code does that

when you're setting the variables and not scraping anything.

 

I'm SOOO confused :)

Link to post
Share on other sites

so change the variable that has them in it static to the scrape attribute, and scrape the item on the page first.

 

im just going by what you supplied.  if you give a link to where it shows up i can make the scrape attribute for you as well.

  • Like 1
Link to post
Share on other sites

No it's my bad LoWrIdErTJ you've given me enough to at least get pointed in the right direction. If I have any more issues I'll post again.

 

Thank you for your continued support here man...you're awesome man! :)

Link to post
Share on other sites

We're almost there guys, here is the code I'm using...

set(#month, $scrape attribute(<name="fenddate">, "innerhtml"), "Global")
    add list to list(%month, $find regular expression(#month, "(\\d+\\-\\d+\\-\\d+)|\\s\\(\\d+\\)"), "Delete", "Global")
    set(#month, %month, "Global")
    set(#month, $replace(#month, $new line, ","), "Global")
    set(#Choose Your Month, $plugin function("File Management.dll", "$dropdown dialog", "Choose Your Month", "Choose Your Month:", #month), "Global")

And that produces the list but the values are separated like this:

#month: 2013-07-23,2013-07-24, (16616),2013-07-25, (18812),2013-07-26, (19446),2013-07-27, (15781),2013-07-28, (14578),2013-07-29, (16213),2013-07-30, (17898),2013-07-31, (15733),2013-08-01, (19123),2013-08-02, (17264),2013-08-03, (14857),2013-08-04, (13243),2013-08-05, (15079),2013-08-06, (15120),2013-08-07, (12314),2013-08-08, (15000),2013-08-09, (17077),2013-08-10, (4092),2013-08-11, (2911),2013-08-12, (2945),2013-08-13, (3039),2013-08-14, (2721),2013-08-15, (3251),2013-08-16, (2817),2013-08-17, (3001),2013-08-18, (3014),2013-08-19, (707),2013-08-20, (476),2013-08-21, (538),2013-08-22, (672)

So first off there is a choice that is just a "-" character with no quotes that still isn't pulled yet

And then the choices are not formatted properly...

 

They should look like this:

- (This is the first default choice)

2013-07-23

2013-07-24 (16616)

etc...

 

But for some reason it's putting the (16616) etc on a new line.

 

How can I fix that to pull in the rest of the string and not put those

as new choices in the drop down?

Link to post
Share on other sites

Well I figured out why the dates were messed up...Got that fixed but I still can't


see why I can't pull in the first default choice of "-" without the quotes.

Link to post
Share on other sites

set(#month$scrape attribute(<name="fenddate">"innerhtml"), "Global")
add list to list(%month$find regular expression(#month"(\\d+\\-\\d+\\-\\d+)|\\s\\(\\d+\\)"), "Delete""Global")
set(#month%month"Global")
set(#month$replace(#month$new line","), "Global")
set(#Choose Your Month"-,{$plugin function("File Management.dll""$dropdown dialog""Choose Your Month""Choose Your Month:"#month)}""Global")

Link to post
Share on other sites

I just used add item to list before the add list to list and it seems to be working fine now :)

 

Thank you for all your help man! I appreciate it! A LOT! :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...