{"id":13449354,"url":"https://github.com/lipoja/URLExtract","last_synced_at":"2025-03-22T22:32:53.586Z","repository":{"id":3404174,"uuid":"49364338","full_name":"lipoja/URLExtract","owner":"lipoja","description":"URLExtract is python class for collecting (extracting) URLs from given text based on locating TLD.","archived":false,"fork":false,"pushed_at":"2024-02-29T09:12:30.000Z","size":333,"stargazers_count":243,"open_issues_count":29,"forks_count":61,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-02T08:28:48.394Z","etag":null,"topics":["extract","extractor","hacktoberfest","urls"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lipoja.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-10T11:38:03.000Z","updated_at":"2024-09-25T10:00:45.000Z","dependencies_parsed_at":"2024-06-18T13:43:18.493Z","dependency_job_id":"73bc357a-43a6-481a-adcb-caad3333deaa","html_url":"https://github.com/lipoja/URLExtract","commit_stats":{"total_commits":242,"total_committers":20,"mean_commits":12.1,"dds":0.2520661157024794,"last_synced_commit":"7a236d46f4c9d22a527f2f22844370da033b442d"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipoja%2FURLExtract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipoja%2FURLExtract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipoja%2FURLExtract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipoja%2FURLExtract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lipoja","download_url":"https://codeload.github.com/lipoja/URLExtract/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221840634,"owners_count":16889834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extract","extractor","hacktoberfest","urls"],"created_at":"2024-07-31T06:00:36.227Z","updated_at":"2024-10-28T14:30:50.266Z","avatar_url":"https://github.com/lipoja.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"URLExtract\n----------\n\nURLExtract is python class for collecting (extracting) URLs from given\ntext based on locating TLD.\n\n\n.. image:: https://img.shields.io/github/actions/workflow/status/lipoja/URLExtract/python-package.yml?branch=master\n    :target: https://github.com/lipoja/URLExtract/actions/workflows/python-package.yml\n    :alt: Build\n.. image:: https://img.shields.io/github/tag/lipoja/URLExtract.svg\n    :target: https://github.com/lipoja/URLExtract/tags\n    :alt: Git tag\n.. image:: https://img.shields.io/pypi/pyversions/urlextract.svg\n    :target: https://pypi.python.org/pypi/urlextract\n    :alt: Python Version Compatibility\n.. image:: https://img.shields.io/pypi/dw/urlextract\n    :target: https://pypistats.org/packages/urlextract\n    :alt: PyPI downloads per week\n.. image:: https://img.shields.io/pypi/dm/urlextract\n    :target: https://pypistats.org/packages/urlextract\n    :alt: PyPI downloads   \n\n\nHow does it work\n~~~~~~~~~~~~~~~~\n\nIt tries to find any occurrence of TLD in given text. If TLD is found it\nstarts from that position to expand boundaries to both sides searching\nfor \"stop character\" (usually whitespace, comma, single or double\nquote).\n\nA dns check option is available to also reject invalid domain names.\n\nNOTE: List of TLDs is downloaded from iana.org to keep you up to date with new TLDs.\n\nInstallation\n~~~~~~~~~~~~\n\nPackage is available on PyPI - you can install it via pip.\n\n.. image:: https://img.shields.io/pypi/v/urlextract.svg\n    :target: https://pypi.python.org/pypi/urlextract\n.. image:: https://img.shields.io/pypi/status/urlextract.svg\n    :target: https://pypi.python.org/pypi/urlextract\n\n::\n\n   pip install urlextract\n\nDocumentation\n~~~~~~~~~~~~~\n\nOnline documentation is published at http://urlextract.readthedocs.io/\n\n\nRequirements\n~~~~~~~~~~~~\n\n- IDNA for converting links to IDNA format\n- uritools for domain name validation\n- platformdirs for determining user's cache directory\n- dnspython to cache DNS results\n\n   ::\n\n       pip install idna\n       pip install uritools\n       pip install platformdirs\n       pip install dnspython\n\nOr you can install the requirements with `requirements.txt`:\n\n   ::\n\n       pip install -r requirements.txt\n\n\nRun tox\n~~~~~~~\n\nInstall tox:\n\n   ::\n\n       pip install tox\n\nThen run it:\n\n   ::\n\n       tox\n\nExample\n~~~~~~~\n\nYou can look at command line program at the end of *urlextract.py*.\nBut everything you need to know is this:\n\n.. code:: python\n\n    from urlextract import URLExtract\n\n    extractor = URLExtract()\n    urls = extractor.find_urls(\"Text with URLs. Let's have URL janlipovsky.cz as an example.\")\n    print(urls) # prints: ['janlipovsky.cz']\n\nOr you can get generator over URLs in text by:\n\n.. code:: python\n\n    from urlextract import URLExtract\n\n    extractor = URLExtract()\n    example_text = \"Text with URLs. Let's have URL janlipovsky.cz as an example.\"\n\n    for url in extractor.gen_urls(example_text):\n        print(url) # prints: ['janlipovsky.cz']\n\nOr if you want to just check if there is at least one URL you can do:\n\n.. code:: python\n\n    from urlextract import URLExtract\n\n    extractor = URLExtract()\n    example_text = \"Text with URLs. Let's have URL janlipovsky.cz as an example.\"\n\n    if extractor.has_urls(example_text):\n        print(\"Given text contains some URL\")\n\nIf you want to have up to date list of TLDs you can use ``update()``:\n\n.. code:: python\n\n    from urlextract import URLExtract\n\n    extractor = URLExtract()\n    extractor.update()\n\nor ``update_when_older()`` method:\n\n.. code:: python\n\n    from urlextract import URLExtract\n\n    extractor = URLExtract()\n    extractor.update_when_older(7) # updates when list is older that 7 days\n\nKnown issues\n~~~~~~~~~~~~\n\nSince TLD can be not only shortcut but also some meaningful word we might see \"false matches\" when we are searching\nfor URL in some HTML pages. The false match can occur for example in css or JS when you are referring to HTML item\nusing its classes.\n\nExample HTML code:\n\n.. code-block:: html\n\n  \u003cp class=\"bold name\"\u003eJan\u003c/p\u003e\n  \u003cstyle\u003e\n    p.bold.name {\n      font-weight: bold;\n    }\n  \u003c/style\u003e\n\nIf this HTML snippet is on the input of ``urlextract.find_urls()`` it will return ``p.bold.name`` as an URL.\nBehavior of urlextract is correct, because ``.name`` is valid TLD and urlextract just see that there is ``bold.name``\nvalid domain name and ``p`` is valid sub-domain.\n\nLicense\n~~~~~~~\n\nThis piece of code is licensed under The MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flipoja%2FURLExtract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flipoja%2FURLExtract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flipoja%2FURLExtract/lists"}