Remove unneccessary query-string from the URL given. Especially fbclid.
Project description
no-more-query-string
Remove unneccessary query-string from the URL given. Especially fbclid.
Changelog
Installation
pip install no-more-query-string
Usage
from no_more_qs import NoMoreQS
nmq = NoMoreQS()
url = "https://www.youtube.com/watch?v=h-RHH79hzHI&feature=emb_logo&ab_channel=Ceia"
nmq.clean(url)
# 'https://www.youtube.com/watch?v=h-RHH79hzHI'
or you just want to remove fbclid
url = "https://www.youtube.com/watch?v=h-RHH79hzHI&feature=emb_logo&ab_channel=Ceia&fbclid=IwAR2NasdasdasdadasdfP58isTW-c3U"
NoMoreQs.remove_fbclid(url)
# 'https://www.youtube.com/watch?v=h-RHH79hzHI&feature=emb_logo&ab_channel=Ceia'
Parameters
fbclid will be cleaned from all domains
# default
NoMoreQS(include_flds=[], exclude_flds=[], strict=True)
include_flds ( List[str] | Tuple[str]
=[] )
first-level domains list which are allowed to clean query string.
include_flds = ('youtube.com', 'google.com')
url = "https://www.youtube.com/watch?v=h-RHH79hzHI&feature=emb_logo&ab_channel=Ceia&fbclid=IwAR2NasdasdasdadasdfP58isTW-c3U"
NoMoreQS(include_flds=include_flds).clean(url)
# 'https://www.youtube.com/watch?v=h-RHH79hzHI'
exclude_flds ( List[str] | Tuple[str]
=[] )
first-level domains which are disallowed to clean query string.
exclude_flds = ('youtube.com', 'google.com')
url = "https://www.youtube.com/watch?v=h-RHH79hzHI&feature=emb_logo&ab_channel=Ceia&fbclid=IwAR2NasdasdasdadasdfP58isTW-c3U"
NoMoreQS(exclude_flds=exclude_flds).clean(url)
# 'https://www.youtube.com/watch?v=h-RHH79hzHI&feature=emb_logo&ab_channel=Ceia'
strict ( bool
=True )
if the domain is not in include_flds
or exclude_flds
- True(default): Remove all unneccessary query string.
- False: Only remove
fbclid
from query string.
url = "https://www.youtube.com/watch?v=h-RHH79hzHI&feature=emb_logo&ab_channel=Ceia&fbclid=IwAR2NasdasdasdadasdfP58isTW-c3U"
NoMoreQS(strict=True).clean(url)
# 'https://www.youtube.com/watch?v=h-RHH79hzHI'
NoMoreQS(strict=False).clean(url)
# 'https://www.youtube.com/watch?v=h-RHH79hzHI&feature=emb_logo&ab_channel=Ceia'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for no-more-query-string-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 230e8969e6a715887e3c41148e722251a85dc2ecc992f4297f6dd94c036753f9 |
|
MD5 | 28f62042d42879e6c308b55c69166a13 |
|
BLAKE2b-256 | 6e6dbb69e9dfa6c3916d985e701cef16b2947fae0d66868972adc0c10496c51d |
Close
Hashes for no_more_query_string-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34dccedd6f4cf65a6889f5b2d612000e693711b8542cc629d40a768cba525d71 |
|
MD5 | 73fef3d6b34ff2f73594243bac662ef7 |
|
BLAKE2b-256 | e00e6322ad16a9087e46058ee15fb01dabc418cc1c79db0f0c1774b7464c014c |