Comments (5)
Hi,
thank you for describing this use case. I agree with you in some points. For example my use case was to have always up to date list of TLDs. That is why I wanted to download the file and not keeping it in repository.
But I think It is good idea, especially for the testing purposes. I will think about it and do it in some way.
from urlextract.
I think it's saner for the package to include in it a copy of the file. If the file is very large, it can be stored compressed. It's not a bad idea to just update the package on PyPI every once in a while with the new file.
from urlextract.
Think about the use of the package in a serverless setting where instances can be torn down and recreated on demand from scratch. We wouldn't want the file to be downloaded over and over again for no reason, would be. Similarly, think of build bots that rebuild after each commit.
from urlextract.
Thanks for the suggestion, I've added list of TLDs to the package.
from urlextract.
It's late, so my apologies if I'm overlooking something, but would it be an idea to add a parameter to URLExtract() to make it so it does not need a writeable cache directory?
I'm using URLExtract in an AWS Lambda function and I'm pointing URLExtract to the cache directory:
URLExtract(cache_dir=Path(f'{os.getenv("LAMBDA_TASK_ROOT")}/urlextract/data'))
which generates an error:
CacheFileError: Cache directory /var/task/urlextract/data is not writable.
The error is caused by
URLExtract/urlextract/cachefile.py
Line 141 in 638c0e2
Update 1: I'll try and solve it by copying the data to a writeable /tmp directory
Update 2: I could use /tmp as my user-defined cache directory and have URLExtract download the list there, but as @lipoya mentioned earlier, that could imply overloading the servers from where the list is downloaded.
from urlextract.
Related Issues (20)
- 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
- Handle upper-case false positives HOT 9
- 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
- Add `py.typed` marker to source and package
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.