The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
Generate possible sitemaps
Discuss Generate possible sitemaps in the Python Programming forum on Dev Shed. Generate possible sitemaps Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 7th, 2003, 06:38 AM
|
|
Python/RDF Freak
|
|
Join Date: Oct 2003
Posts: 14
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Generate possible sitemaps
Hello,
I'm trying to make a program that scans a site and take all the links. With these links the program have to generate all possible sitemaps.
To generate all sitemaps is the problem. If there are 4 pages on a site there are 100 possible sitemaps.
I'm still thinking how I can do this. Have someone of you any tips or solutions.
I hope I'm clear enough.
grtz from the Netherlands,
Johie
|

October 7th, 2003, 03:27 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|
How do you generate 100 sitemaps out of 4 links? Assuming we have 4 links linkA, linkB, linkC, linkD, how is the sitemap supposed to look like?
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
|

October 7th, 2003, 03:42 PM
|
|
Python/RDF Freak
|
|
Join Date: Oct 2003
Posts: 14
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
If I have the 4 links, you can have several possible tree stuctures.
Root ----LinkA-LinkB-LinkC-LinkD
Root ----LinkA-LinkC-LinkB-LinkD
Or
Root----LinkA-LinkB
|--LinkC-LinkD
Root----LinkD-LinkB
|--LinkC-LinkA
Or
Root -----LinkA-LinkB--LinkC
|-LinkD
If you count all possible combinations you get 100 results.
I hope I have answered your question. Maybe now you know what I mean.
grtz
Johie
|

October 7th, 2003, 07:26 PM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
Sorry i'm lost, how do you get LinkA, LinkB, LinkC and LinkD to yield 100 possible combinations, it seems like allot to me  .. but i might b mistaken. Just out of interest why do you need to generate EVER possible sitemap combo?
As for getting the links in the first place you might want to take a look at urlopen() in the urllib module which will let you read a webpage like any other file. You'll then have to get the links from this, you can do that pretty easily this with Pythons re (regular expressions) module.
Have fun,
Mark.
__________________
programming language development: www.netytan.com – Hula
|

October 14th, 2003, 07:41 AM
|
|
Python/RDF Freak
|
|
Join Date: Oct 2003
Posts: 14
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Hi,
After a few trials I saw it is impossible to do this. It takes a long time if there are a lot more links.
But I have another question.
I'd like to parse a website (that's not the problem) but it doesn't work when there are frames on it.
Does anyone know how to parse the frames for links.
I hope this is clear
grtz
johie
|

October 14th, 2003, 07:49 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
Probably the best way to parse a frameset would be to get the page referances from the main stage (manually or as part of the program) and then read and parse all the pages connected to the frame.. not too hard
Mark.
|

October 14th, 2003, 08:33 AM
|
|
Junior Member
|
|
Join Date: Oct 2003
Location: Tucson AZ
Posts: 29
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
sitemap
With only 4 links you are limited to 24 possible sitemaps.
at 5 links you would have 120, but the"root" is always in the first position, as you described it, so it is not effected by this.
Unless you left out information such as each page links to every other page... then you would have 108 possibilities.
This wouldn't be too hard as a loop....
but with additional links this kind of program would get slower.
Perhaps if we knew how/why you would need every possible sitemap and more about the site structure... something simpler can be suggested.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|