473,569 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

url question - extracting (2 types of) domains

Hi,
Im trying to extract the domain name from an url. lets say I call
it full_domain and significant_dom ain(which is the homepage domain)

Eg: url=http://en.wikipedia.or g/wiki/IPod ,
full_domain=en. wikipedia.org ,significant_do main=wikipedia. org

Using urlsplit (of urlparse module), I will be able to get the
full_domain, but Im wondering how to get significant_dom ain. I will
not be able to use like counting the number of dots. etc

Some domains maybe like foo.bar.co.in (where significant_dom ain=
bar.co.in)
I have around 40M url list. Its ok, if I fallout in few(< 1%) cases.
Although I agree that measuring this error rate itself is not clear,
maybe just based on ituition.

Anybody have clues about existing url parsers in python to do this.
Searching online couldnt help me much other than
the urlparse/urllib module.

Worst case is to try to build a table of domain
categories(like .com, .co.il etc and look for it in the suffix rather
than counting dots and just extract the part till the preceding dot),
but Im afraid if I do this, I might miss some domain category.

May 16 '07 #1
3 1912
En Tue, 15 May 2007 23:04:02 -0300, lazy <ar******@gmail .comescribió:
Im trying to extract the domain name from an url. lets say I call
it full_domain and significant_dom ain(which is the homepage domain)
Eg: url=http://en.wikipedia.or g/wiki/IPod ,
full_domain=en. wikipedia.org ,significant_do main=wikipedia. org
You'll have to find a better definition of "significant_do main".
A vaguely related concept would be SOA - Start of Authority. You could
issue DNS queries for a SOA record, removing the heading parts until you
get a matching answer. See http://www.dnspython.org/

--
Gabriel Genellina

May 16 '07 #2

On May 15, 2007, at 9:04 PM, lazy wrote:
Hi,
Im trying to extract the domain name from an url. lets say I call
it full_domain and significant_dom ain(which is the homepage domain)

Eg: url=http://en.wikipedia.or g/wiki/IPod ,
full_domain=en. wikipedia.org ,significant_do main=wikipedia. org

Using urlsplit (of urlparse module), I will be able to get the
full_domain, but Im wondering how to get significant_dom ain. I will
not be able to use like counting the number of dots. etc

Some domains maybe like foo.bar.co.in (where significant_dom ain=
bar.co.in)
I have around 40M url list. Its ok, if I fallout in few(< 1%) cases.
Although I agree that measuring this error rate itself is not clear,
maybe just based on ituition.

Anybody have clues about existing url parsers in python to do this.
Searching online couldnt help me much other than
the urlparse/urllib module.

Worst case is to try to build a table of domain
categories(like .com, .co.il etc and look for it in the suffix rather
than counting dots and just extract the part till the preceding dot),
but Im afraid if I do this, I might miss some domain category.
The best way I know to get an *authoritive* answer is to start with
the full_domain and try a whois lookup. If it returns no records,
drop everything before the first dot and try again. Repeat until you
get a good answer -- this is the significant_dom ain.

hth,
Michael

May 16 '07 #3
Thanks.
Hmm, the url list is quite huge(40M). I think it will take a lot of
time,for a whois lookup I guess. But yeah,
thats seems to be a good way. Probably I will try it with a smaller
set (10K) and see the time it takes.
If not, I guess I will just build a table of known
domains(.com,.o rg,.co.il etc ) and then I can find the
root domain(signific ant_domain) atleast for those and I hope majority
of them fall into this :)
On May 16, 12:32 am, Michael Bentley <mich...@jedimi ndworks.com>
wrote:
On May 15, 2007, at 9:04 PM, lazy wrote:
Hi,
Im trying to extract the domain name from an url. lets say I call
it full_domain and significant_dom ain(which is the homepage domain)
Eg: url=http://en.wikipedia.or g/wiki/IPod,
full_domain=en. wikipedia.org ,significant_do main=wikipedia. org
Using urlsplit (of urlparse module), I will be able to get the
full_domain, but Im wondering how to get significant_dom ain. I will
not be able to use like counting the number of dots. etc
Some domains maybe like foo.bar.co.in (where significant_dom ain=
bar.co.in)
I have around 40M url list. Its ok, if I fallout in few(< 1%) cases.
Although I agree that measuring this error rate itself is not clear,
maybe just based on ituition.
Anybody have clues about existing url parsers in python to do this.
Searching online couldnt help me much other than
the urlparse/urllib module.
Worst case is to try to build a table of domain
categories(like .com, .co.il etc and look for it in the suffix rather
than counting dots and just extract the part till the preceding dot),
but Im afraid if I do this, I might miss some domain category.

The best way I know to get an *authoritive* answer is to start with
the full_domain and try a whois lookup. If it returns no records,
drop everything before the first dot and try again. Repeat until you
get a good answer -- this is the significant_dom ain.

hth,
Michael

May 16 '07 #4

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

Similar topics

1
1544
by: Philippe C. Martin | last post by:
Hi, How would one go about extracting the pickle module from Python (ex: to make a .a or a .dll) ? Thanks Philippe
2
1892
by: Roger Withnell | last post by:
I'm using one set of database tables to serve many different domains, using the domain name to identify the records related to a particular domain. How do I use ASP to extract the domain name for the page I'm in so that I can search the database for the appropriate records?
1
2740
by: Paul Fi | last post by:
I have some confusions about the two, is it possible to create threads inside a particular domain and have other threads created in another domain or do we create threads that will manipulate app domains? i have read this in the .NET framework docs about domains and threads and i need some clarifications on this: There is not a...
6
4851
by: Ludvig | last post by:
I have various domains using the same application/assembly They differ in contents and design, based on a "site id", and get its information from an SQL server. Now I have to deploy the different "sites" to individual folders on the server, and set up the domains on IIS to point to these folders. If I do changes in the application, I have...
7
7768
by: Doug | last post by:
An ASP.NET session cookie set on "www.mydomain.com" can not be accessed on "search.mydomain.com"; hence, a new session and cookie are being created on every sub-domain. This is occuring because ASP.NET always sets the Session cookie domain to the full domain (e.g. "www.mydomain.com") instead of the parent domain (e.g. "mydomain.com") The...
14
3738
by: Adnan Siddiqi | last post by:
Hi Suppose I have following URLs comming from an HTML document <a href="http://mydomain1.com">Domain1</a> <a href="http://subdomain.domain.com/myfile.anyext">http://subdomain.domain.com/myfile.anyext</a> <a href="http://subdomain.domain2.com/myfile.anyext">Domain2</a>
6
4437
by: Werner | last post by:
Hi, I try to read (and extract) some "self extracting" zipefiles on a Windows system. The standard module zipefile seems not to be able to handle this. False Is there a wrapper or has some one experience with other libaries to
3
1840
by: Adam Nielsen | last post by:
Hi everyone, Yet another syntax problem that's baffling me with templates. I want to instantiate a template with a single parameter as per normal, however the parameter is actually a template class itself, with all *its* parameters filled out (in the form of a typedef.) I can't work out how to break apart the typedef to reveal what data...
0
835
by: akshaychand | last post by:
Hi, I am designing a Schema Editor using the Schema Object Model in .NET 2.0. I am currently facing an problem wherein I want to list all the built-in data types as well as the custom types that are defined globally in the schema as well as the custom types that are defined globally in all the imported schemas. Basically, I want to list all...
0
7694
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.