Total members 10259 | Gratitudes |It is currently Mon May 21, 2012 2:43 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 4 posts ] 
Author Question
 Question subject: how to screen scrape or grab some parts of a website?
PostPosted: Tue Jun 23, 2009 2:34 am 
Offline
Newbie
User avatar

Joined: Tue Jun 23, 2009 2:30 am
Posts: 1
Has thanked: 0 time
Have thanks: 0 time

i want to grab the traffic news at this website:
http://www.onemotoring.com.sg/publish/o ... _news.html

i was able to screen scrape the whole page however, i only want to grab the traffic news which are in the table, is there any way that i could do that?

codes at my prac1.aspx:
Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Prac1.aspx.cs" Inherits="Prac1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    Displaying a web page on your own page using Screen Scraping
    <br />
     <asp:Button ID="btnDisplay" runat="server" onclick="btnDisplay_Click"
            Text="Display webpage now" />
        <br />
        <br />
        <asp:Label ID="lblWebpage" runat="server"></asp:Label>
   
    </div>
    </form>
</body>
</html>

codes at my prac1.aspx.cs:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net; //namespace for webclient
using System.Text;

public partial class Prac1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnDisplay_Click(object sender, EventArgs e)
    {
        WebClient webClient = new WebClient();
        const string strUrl = "http://www.onemotoring.com.sg/publish/onemotoring/en/on_the_roads/traffic_news.html";
        byte[] reqHTML;
        reqHTML = webClient.DownloadData(strUrl);
        UTF8Encoding objUTF8 = new UTF8Encoding();
        lblWebpage.Text = objUTF8.GetString(reqHTML);
    }
}


any help??
thank you in advance guys
:))


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: how to screen scrape or grab some parts of a website?
PostPosted: Sat Jun 27, 2009 8:25 am 
Offline
Newbie
User avatar

Joined: Wed Apr 15, 2009 7:18 am
Posts: 32
Has thanked: 0 time
Have thanks: 0 time
i was able to screen scrape the whole page however, i only want to grab the traffic news which are in the table, is there any way that i could do that?

_________________
MySpace Layouts


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: how to screen scrape or grab some parts of a website?
PostPosted: Tue Jun 30, 2009 8:41 am 
Offline
Newbie
User avatar

Joined: Tue Jun 09, 2009 6:05 pm
Posts: 3
Has thanked: 0 time
Have thanks: 0 time
can you get at it using the DOM?

or maybe you will ned to use PREG on the relevant section.

I have done similar in cURL using pattern matching to grab the code I wanted.


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: how to screen scrape or grab some parts of a website?
PostPosted: Sun Jul 19, 2009 6:15 pm 
Offline
Newbie
User avatar

Joined: Sun Jul 19, 2009 5:51 pm
Posts: 1
Has thanked: 0 time
Have thanks: 0 time
Download biterscripting from http://www.biterscripting.com . Start biterscripting. Enter the following command.

The entire code below is just one command. Enter the whole command on one line.

Code:
script SS_WebPageToCSV.txt page("http://www.onemotoring.com.sg/publish/onemotoring/en/on_the_roads/traffic_news.html") number(11)


Try it now. This particular script seems to have been written just for you :-) It is open source. I did not write it, but I have been using it and other biter scripts.

Hope this helps. I am assuming you are getting this data only for your personal use and not to republish.

Randi


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 4 posts ] 
Quick reply


  

 Similar topics
 How can I increase the PageRank of my website on Google?
 Know your goals before building your website
 How to download and save .mov files from this website ?
 play music as your website background.
 link to parts in the same page
 Arabic website partner
 JFrame properties for an Applet to be embedded in website?
 need code for my website
 Splash Screen
 Web content & Website Design

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team