{"id":21279094,"url":"https://github.com/cttricks/knot","last_synced_at":"2025-03-15T13:42:34.676Z","repository":{"id":192028812,"uuid":"387159938","full_name":"cttricks/knot","owner":"cttricks","description":"URL Shortner Made By Using Google Form \u0026 Spreadsheet.","archived":false,"fork":false,"pushed_at":"2021-07-18T12:38:02.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T03:46:12.316Z","etag":null,"topics":["googleforms","googlespreadsheet","javascript","linkshortner"],"latest_commit_sha":null,"homepage":"https://cttricks.github.io/knot/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cttricks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-07-18T11:32:14.000Z","updated_at":"2022-11-07T22:19:46.000Z","dependencies_parsed_at":"2023-09-02T06:43:06.716Z","dependency_job_id":null,"html_url":"https://github.com/cttricks/knot","commit_stats":null,"previous_names":["cttricks/knot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cttricks%2Fknot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cttricks%2Fknot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cttricks%2Fknot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cttricks%2Fknot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cttricks","download_url":"https://codeload.github.com/cttricks/knot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243738955,"owners_count":20339997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["googleforms","googlespreadsheet","javascript","linkshortner"],"created_at":"2024-11-21T10:19:00.692Z","updated_at":"2025-03-15T13:42:34.646Z","avatar_url":"https://github.com/cttricks.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\" style=\"border: none !important\"\u003eKnot\u003cbr\u003e\u003c/h1\u003e\n\u003cp align=\"center\"\u003e✨ The Open Source URL Shortner ✨\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n \n![Build Status](https://badgen.net/apm/license/linter)\n![JS version](https://badgen.net/dub/stars/silly)\n[![Twitter](https://img.shields.io/twitter/url.svg?url=https%3A%2F%2Ftwitter.com%2Fct_tricks\u0026style=social\u0026label=Follow%20%40ct_tricks)](https://twitter.com/ct_tricks)\n\n\u003c/div\u003e\nA very simple URL shortener made by using Google Form \u0026 Spreadsheet as a backend to store and get URL and data. Knot never logs the number of times a URL gets a request or anything. It simply shorts the long URL and stores data in a spreadsheet using google form. It is made just for experimental and educational purposes.\n\n### How it works?\nIn the main landing pagae, there are two inputs. 1st Alias and 2nd Long URL. Here i am using `google form` to store the recored in `google spreadsheet` when a new request is made on `index.html` page. As this is a custom HTML form ( if you don't know how to setup custom html form \u003ca href=\"https://youtu.be/WevO_PDB7E0\" target=\"_blank\"\u003ewatch this tutorial video\u003c/a\u003e ). In this form when a user enter/change alice it get stored in localstorage of browser using.  Now once the form is submitted successfully it redirects users to `shorted.html` page. Here when a user arrives it display the shorted url ( simply by adding alias value at the end of the url). \n\n```javascript\nvar sourceUrl = \"https://cttricks.github.com/knot/load.html?sl=\" + localStorage.getItem(\"alias\");\n\n//Example : https://cttricks.github.com/knot/load.html?sl=tanish\n```\n\nNow when a user visit the shorted url i.e `load.html` page, with the `sl` value. It make a `GET` request on google spreadsheet with `SQL query` in the request url.\n`Query : SELECT B WHERE C ='\" + page.searchParams.get(\"sl\") + \"'\"`\n```javascript\n\nconst baseID = \"Spreadsheet_ID\";\nconst baseName = \"Sheet1\";\nconst page = new URL(window.location.href);\n\nvar url = \"https://docs.google.com/spreadsheets/d/\"+baseID+\"/gviz/tq?tqx=out:json\u0026sheet=\"+baseName+\"\u0026tq=\" + encodeURIComponent(\"SELECT B WHERE C ='\" + page.searchParams.get(\"sl\") + \"'\");\n\n```\nOn response it parse the response text, and loads the long url in the same tab. \n\n### Create your own\nDownload the files of this repo and upload it to the hosting server. And follow these simple steps.\n- Create a new \u003ca href=\"http://forms.google.com/\" target=\"_blank\"\u003egoogle form\u003c/a\u003e\n- Create two fileds, 1st Alias and 2nd Long URL\n- Now get the `entry.codes` of these two fileds. ( you can easily get it by creating a prefilled link )\n- On response section you'll get an option to add response sheet. Click on that, it'll open a spreadhseet for you. Here on the top right corner click on share and set permission to anyone with link can view.\n- Open `index.html` and upadted the `form action url` and `entry.code` with yours\n- Open `shorted.html` and upadted the default shortened link `https://cttricks.github.io/knot/load.html?sl=` with your domain and path to this file.\n- Open `load.html` and update the `baseID` and `baseName` (baseName = sheetname)\n\nAll done, Now test your own `Knot` version of URL shortner.\n\n### 🎯 Why i'm building this ?\nLong ago i made a tutorial on \u003ca href=\"https://youtu.be/WevO_PDB7E0\" target=\"_blank\"\u003ehow to store custom from data to google spreadsheet using google form\u003c/a\u003e. And as we all know, Google Spreadsheet is a very powerful tool and there is an option to query and get data using export method with SQL querys. So i mixed this two thing togather and made this url shortner ( Just as an experiment ) using Google Forms and Spreadsheet. It is not a complete solution. But yeah! Anyone can use this in their small/big projects at their own risk. 😄\n\n⚠️ Use my version of knot only for testing.\n\n\n### 📌 Important Links\n- \u003ca href=\"https://cttricks.github.io/knot/shorted.html\" target=\"_blank\"\u003eKnot Demo\u003c/a\u003e\n- Demo + Tutorial Video (NA)\n\nEnjoy...!!\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcttricks%2Fknot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcttricks%2Fknot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcttricks%2Fknot/lists"}