473,387 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

crawling the net...

Hi NG

I'm making a program to crawl the internet. It works by retrieving all links
in a page, downloading the page of each link and again retrieving all the
links. (If there is better ways I'd like to hear)

My problem is relative links (like "../../wohoo.asp"). What is the smartest
way to get the full url (http://www.xyz.com/wohoo.asp)? Do I have to parse
the relative link in relation to the url where the relative link was found
and then concatenate it? Does anyone know how other search-engines/ crawlers
walk the net?
Thanks :)

../ask
Nov 16 '05 #1
4 1780
ask josephsen posted:
Hi NG

I'm making a program to crawl the internet. It works by retrieving all
links in a page, downloading the page of each link and again retrieving
all the links. (If there is better ways I'd like to hear)

My problem is relative links (like "../../wohoo.asp"). What is the
smartest way to get the full url (http://www.xyz.com/wohoo.asp)? Do I
have to parse the relative link in relation to the url where the
relative link was found and then concatenate it? Does anyone know how
other search-engines/ crawlers walk the net?
Thanks :)

./ask


You should have posted this on:

alt.sports.gymnastics
It would've been more on-topic _there_.

-JKop
Nov 16 '05 #2
Hi Ask,

You could try using the features of Path.GetFullPath which collapses /../
and /./ and returns the proper path. However, it insists on adding the
application path so you will need to do something like

string newUrl =
Path.GetFullPath(url).Substring(Application.Startu pPath.Length+1));

It will switch the / to \ though. Oh, and remove the http:// from the url
first.

There are plenty web crawlers, just do a web searh on "web crawler" and
"web bot".
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3
I'm not developing webcrawlers, but a quick thought of mine is

string link = "../../wohoo.asp"
string thisPageURL = "http://www.xyz.com/wohoo.asp"
stirng [] linkParts = System.Text.RegularExpressions.Regex.Split(link,
"x2Ex2E/"); // split on ../
string [] URLParts = System.Text.RegularExpressions.Regex.Split(thisPag eURL,
"/");

the length of linkParts.Lenght - 1 will now contain the wanted numbers of
"../" "directory recursion" and the last element will be the wanted page
the URL to the new page will be concatenated from the URLParts array,
exluding the the linkPartLength number of elements, and the last element in
LinkParts

Just a quick shot at an solution...

/mortb
"ask josephsen" <jaj(((a)))oticon.dk> wrote in message
news:40**********************@news.dk.uu.net...
Hi NG

I'm making a program to crawl the internet. It works by retrieving all links in a page, downloading the page of each link and again retrieving all the
links. (If there is better ways I'd like to hear)

My problem is relative links (like "../../wohoo.asp"). What is the smartest way to get the full url (http://www.xyz.com/wohoo.asp)? Do I have to parse
the relative link in relation to the url where the relative link was found
and then concatenate it? Does anyone know how other search-engines/ crawlers walk the net?
Thanks :)

./ask

Nov 16 '05 #4
ask josephsen <jaj(((a)))oticon.dk> spoke thus:
I'm making a program to crawl the internet. It works by retrieving all links
in a page, downloading the page of each link and again retrieving all the
links. (If there is better ways I'd like to hear)


(You could look at how wget is implemented. Or, better, just USE wget.)

Your post is off-topic for comp.lang.c++. Please visit

http://www.slack.net/~shiva/welcome.txt
http://www.parashift.com/c++-faq-lite/

for posting guidelines and frequently asked questions. Thank you.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John Bradbury | last post by:
I am trying to develop a special putpose crawler using htmllib & urllib. How do you tell the server application that you are a modern browser and can handle frames? Thanks, john Bradbury
1
by: Benjamin Lefevre | last post by:
I am currently developping a web crawler, mainly crawling mobile page (wml, mobile xhtml) but not only (also html/xml/...), and I ask myself which speed I can reach. This crawler is developped in...
4
by: ask josephsen | last post by:
Hi NG I'm making a program to crawl the internet. It works by retrieving all links in a page, downloading the page of each link and again retrieving all the links. (If there is better ways I'd...
0
by: Jason Manfield | last post by:
I am trying to crawl the Web using HttpWebRequest and HttpWebResponse for the each of the links I discover. For content types like Application/pdf etc., I am able to convert the pdf file to text...
3
by: Mark | last post by:
Our site gets searched by robots all the time. This is great. However, many of our pages that we want to be cataloged are data driven, so we end up with pages like: ...
1
by: chris | last post by:
I need to know if a web crawler simulates a link or if it redirects to a link. Meaning i have a link that looks like this <a href="#" onclick=redirect(5))>Home</a> Will a crawler be able...
0
by: Heimlich Manure | last post by:
I'm emulating ROLAP in Postgres, populating a sorta-cube from a table with 200 million rows in it. Many aggregates over around 20 fields. Two questions : 1. Currently, it takes 1000 seconds to...
4
by: S Borg | last post by:
Hello, I have been writing very simple Python programs that parse HTML and such, mainly just to get a better feel for the language. Here is my question: If I parsed an HTML page into all of the...
0
by: Viktor Barasov | last post by:
I am searching for a web page where I can enter a new web page in russian language that should be visited by russian search engines/catalogs (like yahoo.ru) for indexing. Are there some...
2
by: teressa | last post by:
Hi Everyone, I was given a task to fix our printer friendly pages: Best practice recommendation was to dynamically load a JavaScript page. I have an asp page which is a printer-friendly page...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.