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'
Method parameters
NoMoreQS().clean(url, allow_og_url=False)
allow_og_url ( bool
=False )
if can't find canonical url
, will return og url
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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e91c1d33d64a352b2af10546a50bded084d2ebbda07fe36ff03578cab0f40937 |
|
MD5 | 5413ebeef2297497ac3d44a63df496c0 |
|
BLAKE2b-256 | 895d3ca9b6b3e263e31d1848019889b54881b88383007ae6bf46f6bfa1313d65 |
Close
Hashes for no_more_query_string-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cdbeceae441cef4f96154ecb7de637238db7d0dfeaac829d706a4492778765a |
|
MD5 | d6d86d77dd4fe55edc6d48ad7f33ba53 |
|
BLAKE2b-256 | c03adaf5c27291559bc3ff139196a4d6394419f930fa66353d3c30033551d38a |