-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
|
||
# get matching regex from content | ||
def get_by_regex(regex: re.Pattern, content: str) -> Union[str, None]: | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pawanpaudel93
Author
Owner
|
||
def get_by_regex(regex, content: str) -> Union[str, None]: | ||
"""Matches content by regex and returns the value captured by the first group, or None if there was no match | ||
:param regex: A compiled regex to match | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,7 +74,7 @@ def __init__(self, useragent: str = None, timeout: int = 5): | |
self._tvg_id_regex = re.compile(r"tvg-id=\"(.*?)\"", flags=re.IGNORECASE) | ||
self._logo_regex = re.compile(r"tvg-logo=\"(.*?)\"", flags=re.IGNORECASE) | ||
self._category_regex = re.compile(r"group-title=\"(.*?)\"", flags=re.IGNORECASE) | ||
self._title_regex = re.compile("[,](?!.*[,])(.*?)$", flags=re.IGNORECASE) | ||
self._title_regex = re.compile(r"(?!.*=\",?.*\")[,](.*?)$", flags=re.IGNORECASE) | ||
self._country_regex = re.compile(r"tvg-country=\"(.*?)\"", flags=re.IGNORECASE) | ||
self._language_regex = re.compile( | ||
r"tvg-language=\"(.*?)\"", flags=re.IGNORECASE | ||
|
@@ -463,7 +463,7 @@ def _get_m3u_content(self) -> str: | |
if stream_info.get("category"): | ||
line += ' group-title="{}"'.format(stream_info["category"]) | ||
if stream_info.get("name"): | ||
line += ", " + stream_info["name"] | ||
line += "," + stream_info["name"] | ||
This comment has been minimized.
Sorry, something went wrong.
dineiar
Contributor
|
||
content.append(line) | ||
content.append(stream_info["url"]) | ||
return "\n".join(content) | ||
|
@@ -506,7 +506,7 @@ def with_extension(name, ext): | |
ndict_to_csv(self._streams_info, filename) | ||
logging.info("Saved to file: %s" % filename) | ||
else: | ||
logging.info("Saving to csv file not supported in trim mode") | ||
logging.info("Saving to csv file not supported in trim mode !!!") | ||
|
||
elif format == "m3u": | ||
content = self._get_m3u_content() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,12 @@ | |
|
||
# Package meta-data. | ||
NAME = "m3u_parser" | ||
DESCRIPTION = "A useful module for parsing m3u files or links" | ||
DESCRIPTION = "A useful package for parsing m3u files or links" | ||
URL = "https://github.com/pawanpaudel93/m3u_parser" | ||
EMAIL = "[email protected]" | ||
AUTHOR = "Pawan Paudel" | ||
REQUIRES_PYTHON = ">=3.0" | ||
VERSION = "0.1.5" | ||
VERSION = "0.1.6" | ||
|
||
REQUIRED = ["requests", "asyncio", "aiohttp", "pycountry"] | ||
|
||
|
Why did you remove this type hint @pawanpaudel93? It seems that this function always receive a compiled regex anyway, so the type hint seems correct to me.