
Paket Node & Pengguna -Usang yang Menghapus Parameter Pelacakan atau Sampah dari URL yang membuatnya lebih pendek, lebih bersih, dan jauh lebih baik untuk dibaca.
Anda dapat menggunakan ini secara otomatis di browser dengan Userscript.
npm install tidy-url
import { TidyURL } from 'tidy-url' ;
// or
const { TidyURL } = require ( 'tidy-url' ) ;Kemudian lewati URL dan biarkan keajaiban terjadi:
const link = TidyURL . clean ( 'https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih?si=-k8RwDQwTCK923jxZuy07w&utm_source=copy-link' ) ;
console . log ( link . url ) ; // https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih Anda dapat memvalidasi URL menggunakan fungsi validate .
TidyURL . validate ( 'https://example.com' ) ; // true
TidyURL . validate ( 'cat' ) ; // false
TidyURL . validate ( 'google.com' ) ; // false (protocol is required!) Secara default, Tidy-URL akan menghapus parameter pengalihan dan tautan AMP jika aturan mendukungnya.
Anda dapat menonaktifkan fitur ini dengan allowRedirects dan allowAMP . Contoh:
// These are the defaults.
TidyURL . config . setMany ( {
allowAMP : false ,
allowRedirects : true
} ) ;
TidyURL . clean ( 'https://www.google.com/amp/s/github.com' ) ;
TidyURL . clean ( 'https://steamcommunity.com/linkfilter/?url=https://github.com' ) ;
// Result for both: https://github.comInfo lebih lanjut tentang amp di wiki .
Anda akan selalu menerima tanggapan yang valid, bahkan jika tidak ada yang dimodifikasi. Misalnya:
const link = TidyURL . clean ( 'https://duckduckgo.com/this-is-fine' ) ;
link . url ; // https://duckduckgo.com/this-is-fine
link . info . reduction ; // 0 (percent) Anda dapat melihat semua situs yang didukung khusus di sini.
Namun, aturan global akan cukup untuk bekerja dengan ribuan situs di internet. Anda harus dapat melewati URL apa pun untuk dibersihkan.
Minta dukungan langsung untuk situs web di sini
Responsnya akan selalu menjadi objek dengan rincian apa yang dibersihkan atau dimodifikasi dalam URL.
Ini dapat digunakan untuk debugging, pengujian atau cara sederhana untuk memberi tahu pengguna bahwa mereka bisa mengirim tautan yang lebih pendek.
{
"url" : " https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih " ,
"info" : {
"original" : " https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih?si=-k8RwDQwTCK923jxZuy07w&utm_source=copy-link " ,
"reduction" : 47 ,
"difference" : 47 ,
"replace" : [],
"removed" : [
{
"key" : " utm_source " ,
"value" : " copy-link "
},
{
"key" : " si " ,
"value" : " -k8RwDQwTCK923jxZuy07w "
}
],
"match" : [
{
"rules" : [ " si " , " utm_source " , " context " ],
"replace" : [],
"redirect" : " " ,
"name" : " spotify.com " ,
"match" : " /open.spotify.com/i "
}
],
"decoded" : null ,
"isNewHost" : false ,
"fullClean" : true
}
}Putar monstrositas ini:
https://poetsroad.bandcamp.com/?from=search&search_item_id=1141951669&search_item_type=b&search_match_part=%3F&search_page_id=1748155363&search_page_no=1&search_rank=1&search_sig=a9a9cbdfc454df7c2999f097dc8a216b
https://www.audible.com/pd/Project-Hail-Mary-Audiobook/B08G9PRS1K?plink=GZIIiCHG0Uo5V8ND&ref=a_hp_c9_adblp13nmpxxp13n-mpl-dt-c_1_2&pf_rd_p=164101a8-2aab-4c5e-91ee-1f39e10719e6&pf_rd_r=2Q5R6VH8HJAD48PSQRS4
https://www.amazon.com/Alexander-Theatre-Sessions-Poets-Fall/dp/B08NT852YT/ref=sr_1_1?dchild=1&keywords=Poets+of+the+fall&qid=1621684985&sr=8-1
https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih?si=-k8RwDQwTCK923jxZuy07w&utm_source=copy-link
https://www.aliexpress.com/item/1005001913861188.html?spm=a2g0o.productlist.0.0.b1c55e86sFKsxH&algo_pvid=b4648621-2371-4d1e-9a9c-89b4d6c59395&algo_expid=b4648621-2371-4d1e-9a9c-89b4d6c59395-0&btsid=0b0a556816216865399393168e562d&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_
https://www.google.com/search?q=cat&source=hp&ei=AwGpYKzyE7uW4-EPy_CnSA&iflsig=AINFCbYAAAAAY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2Uyd01pbTVINDRjNlhf124ySEZqMHBJbnFEWDdiMTNUVQ&q=https%3A%2F%2Ftomscott.com%2F&v=k7fXbdRH9v4
Ke dalam ini:
https://poetsroad.bandcamp.com/
https://www.audible.com/pd/Project-Hail-Mary-Audiobook/B08G9PRS1K
https://www.amazon.com/Alexander-Theatre-Sessions-Poets-Fall/dp/B08NT852YT
https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih
https://www.aliexpress.com/item/1005001913861188.html
https://www.google.com/search?q=cat
https://www.vudu.com/content/movies/details/Moonlight-Season-1/133120
https://tomscott.com/
Kontribusi, masalah, dan permintaan fitur dipersilakan dan sangat dihargai!
Jangan ragu untuk memeriksa halaman masalah. Jika Anda menemukan situs web yang tidak didukung, silakan buat masalah dan saya akan dengan senang hati menambahkannya.
Proyek ini dibuat oleh Kain (ksir.pw)
Jangan ragu untuk menghubungi saya jika Anda memiliki masalah dengan paket ini.