Developing first scrape for my work
Hi there-
I first off want to commend on what a great product this is! I have wrote screen scrape programs in the past via MS Access and it was a PAIN! I am an engineer for FedEx and I am trying to use screen scraper to pull some employee scanning information from our internal website each day.
Here are the problems I am running into
1. Lost on how to write a good extractor to get the data I want (Went through the tutorials and still lost...HA HA)
2. How to write a script to output the results so I can get them into MS Access
3. How to loop different variable's (loop through different employee numbers from a list)
Here is the html code from the website ( I only want to extract the information below where it says "
CONs Scanning Breakdown
", I need all the detail information inclosed within the "
" below where it says "CONs Scanning Breakdown"
HTTP/1.1 200 OK
Transfer-Encoding: chunked Server: Apache/2.0.59 (Unix) mod_python/3.1.3 Python/2.3.4 Content-Type: text/html Date: Mon, 14 Dec 2009 17:34:33 GMT <?xml version="1.0" encoding="ISO-8859-1"?> <div class="menu_box"><label class="menu_category">Maintenance</label> <ul class="menu_section"> <li><a class="menu_link" href="http://psr-anc-cluster.lhsprod.fedex.com/splits/splitmopmenu.psp">Split Groups</a></li> <li><a class="menu_link" href="http://psr-anc-cluster.lhsprod.fedex.com/splits/splitgrouppick.psp">Splits</a></li> <label class="menu_category">Reports</label> <ul class="menu_section"> <label class="menu_category">Administrative</label> <ul class="menu_section"> <li><a class="menu_link" href="http://psr-anc-cluster.lhsprod.fedex.com/log_out.psp">Log Out</a></li> <div class="body_box"><!--=====================================================================--> <hr /> <table> <tr> <h3>CONs Scanning Breakdown</h3> <table> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <!--=====================================================================--> |
jsncochran, Sorry for the
jsncochran,
Sorry for the late reply. Addressing your issues:
1. I took your sample html and created a simple scraping session with it. I was able to create one extractor patterned that looks like this to extract only the data below the "CONs Scanning Breakdown" section.
2. You have a few options when saving scraped data to a database. Here is our FAQ on the topic.
http://community.screen-scraper.com/FAQ/Database
3. Assuming you mean to loop through different employee numbers as input into your scraping session, you could modify the script, "Initialize--Input from CSV".
Feel free to post any other questions.
-Scott
I tired using that extractor
I tired using that extractor pattern, but it does not seem to be working. Any other ideas? I think the problem is that sometimes one of those fields could be blank for an employee and it gives me the wrong information. Other than that I got the loop to work and the output, but the extractor I think could be my problem. Any ideas? What information do I need to share to show you?
Don't forget to use regex
jsncochran,
It rare that you would NOT want to use some regex for an extractor pattern token. In this case I recommend using the pre-loaded "Non-HTML tags" (means, "match anything that is not an HTML tag") for all five tokens. This way if there is no value it will not return data from other fields.
-Scott
Hi Scott- I am kinda
Hi Scott-
I am kinda confused. How would I do that. I am completely lost on that one.
Edit Token
jsncochran,
In the workbench, select a scrapeable file that you know has extractor patterns, click the Extractor Patterns tab, for any given extractor pattern token (identified by ~@@~) either double-click the token or highlight the text between the "@" symbols and right-click and choose edit token. In the dialog that pops up you'll see an area labeled "Regular Expressions". Click on the drop-down menu and scroll to "Non-HTML Tags". Close the dialog window.
Repeat the above for all five of your tokens in the extractor pattern we've been discussing.
-Scott