Comments (9)
Released v1.8.0
from urlextract.
@GokulNC Thank you, I am glad that you are using it.
We can discuss this problem, however according to RFC3986
host = IP-literal / IPv4address / reg-name
where
reg-name = *( unreserved / pct-encoded / sub-delims )
and from that
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
and from that and RFC2234
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
I assume that domain names may contain upper-case letters.
Also RFC3986 says: The host subcomponent is case-insensitive.
Therefore I assume that somebody can write EXAMPLE.COM
and he/she might be expecting to match (extract) this domain.
Do you agree?
Maybe I would go in your case with some pre-processing of text? That could help, right?
My opinion is that we can not do specific implementation to this library. I am trying to keep it as generic as possible and I do it according the books (RFCs). And I would expect that users knows the text they are processing so some special tweaks of text might be needed.
from urlextract.
Thanks for your response!
I came across this clarification regarding the above: RFC4343
Please check it out and let me know if you still think the same.
from urlextract.
@GokulNC Thank you for this RFC. I went through the document and I still stand by my opinion.
The RFC4343 is about DNS. If I am not wrong then DNS server should accept case-insensitive domain names. That means that in DNS request domain can appear lover-case, upper-case or combination and DNS should still return results.
I might not be correct, maybe I missed something. If it is that case could you quote from the RFC here so we can discuss it?
Thank you.
from urlextract.
Yes you are right, the domain names are treated case-insensitive, by lower-casing everything at the DNS server side.
One suggestion for this library if possible:
We can add a parameter called match_only_lowercase_domains
, which can default to False
as you suggested.
I believe a flag like this would give more flexibility to the users to avoid false positives like above.
Thanks!
from urlextract.
I will keep this suggestion in my mind. However I want to help you. What about using urlextract.ignore_list
?
from urlextract import URLExtract
urlextract = URLExtract()
urlextract.ignore_list = {"s.no"}
urlextract.find_urls("random text example.com S.No. 3")
outputs:
['example.com']
from urlextract.
Thanks @lipoja ! Was not aware of ignore_list
.
But, this is not possible to do, since it is not possible to construct the list of all false-positives involving such upper-case strings.
For example, consider this random example:
>>> urlextract.find_urls("I am sitting outside.In the middle of nowhere.My mind is lost in thoughts!")
['outside.In', 'nowhere.My']
from urlextract.
@GokulNC alright then in next release it will be available.
You can use urlextract.allow_mixed_case_hostname = False
it should do the trick
from urlextract.
That's awesome! Thanks alot @lipoja :)
from urlextract.
Related Issues (20)
- IPv6? HOT 1
- left walk does not stop on various unicode chars HOT 1
- should not grab email fragments HOT 1
- comma extracted at the end if url ends with comma HOT 3
- travis-ci seems no longer active repository HOT 2
- URLExtract() init really slow
- ERROR: Can not download list of TLDs. (URLError: [Errno 104] Connection reset by peer) HOT 2
- Does Not extract the URL that is leading special character
- urlextract without authority causes AttributeError HOT 2
- Wrong indices and incomplete extraction when string contains similar urls HOT 1
- Unable to detect t.me links HOT 1
- Bug with flag `allow_mixed_case_hostname=False` HOT 4
- Extracting Markdown Text, doesn't process escaped \\ correctly HOT 1
- Support non-unicode hostname HOT 3
- Support for private/reserved/custom TLDs
- Wrong indices and repeated matches when hostname contains the TLD
- Invalid URLs accepted with subdomains
- red flag from antiviruses HOT 2
- [Errno 11002] Temporary failure in name resolution after using URLExtract HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urlextract.