1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
todoist-github/todoist-github/utils.py

14 lines
348 B
Python

from typing import Optional
from urlextract import URLExtract
from urllib.parse import urlparse
extractor = URLExtract()
def get_github_task(content) -> Optional[str]:
if "github" not in content.lower():
return None
for url in extractor.gen_urls(content):
if urlparse(url).netloc == "github.com":
return url