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
File details
Details for the file no-more-query-string-0.0.8.tar.gz
.
File metadata
- Download URL: no-more-query-string-0.0.8.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f5fa91c4ae13a9a10ec64f86aa9ad8225707d8f76ae63c549dee68d4929c49c |
|
MD5 | 06545ae0ce5c626ee04653e05ce07abd |
|
BLAKE2b-256 | f3369d0910be23405010993913f40c299ad40d8c4df1ad83d1196b1fb74c306f |
File details
Details for the file no_more_query_string-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: no_more_query_string-0.0.8-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 236ac2b00735c3a11179b15aee5f50a9283104b822261ce8a65928e926dfdac6 |
|
MD5 | ac2f57c9e56545bd58a3399d5db96e38 |
|
BLAKE2b-256 | a2540f2388ce82743f4072033c7c99a908734b2099bd9ed19574f0227027086f |