forked from qxresearch/qxresearch-event-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1730a6f
commit bc9ed95
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<br /> | ||
<p align="center"> | ||
<a href="https://www.youtube.com/channel/UCX7oe66V8zyFpAJyMfPL9VA"> | ||
<img width="200px" src="https://github.com/xiaowuc2/xiaowuc2/blob/master/source/qxr/lin.gif" alt="Logo"> | ||
</a> | ||
|
||
<h3 align="center">Link Shortener and Link Extractor</h3> | ||
|
||
<p align="center"> | ||
Python Application | 10 lines of code + Video Explanation 🧭 | ||
<br> | ||
<br /> | ||
</p> | ||
</p> | ||
|
||
You can create a `Python` program which can be used to shorten a big links and also to extract original link from a shorten link. For shortening the link, we'll use a shortening web service named `tinyurl`. You need to give your link in the terminal and you'll get the shorten link/ original link in the print-screen. | ||
``` | ||
What the program does? | ||
1. Shortening Links | ||
- You've to give your big link in the terminal | ||
- Program will use tinyurl server for shortening the link without using any browser | ||
- Shortened link will pass by print() function | ||
2. Extracting Original Links | ||
- You've to give a shorten link in the terminal | ||
- Program will extract the original URL from the shorten link | ||
- Original link will pass by print() function | ||
``` | ||
### Requirements | ||
|
||
* Python | ||
* Python Libraries: `pyshorteners`, `urllib3`, `requests` | ||
|
||
### Contributing | ||
|
||
Any kind of contributions to `qxresearch-event-1/link-shortener` are welcome. While creating an issue(for this project) use `Link-Shortener` Label. | ||
|
||
1. [Fork](https://github.com/qxresearch/qxresearch-event-1/fork) the Project | ||
2. Commit your Changes | ||
3. Open a [Pull Request](https://github.com/qxresearch/qxresearch-event-1/pulls) | ||
|
||
### Video Tutorial | ||
|
||
* **YouTube : ** [Link Shortener](https://youtu.be/JOx_c7ehwKI) | ||
|
||
### Become Official Member @qxresearch | ||
|
||
* Join Mozilla Group [@qxresearch](https://community.mozilla.org/en/groups/qx-research/) | ||
* Join Telegram Group [@qxresearch](https://t.me/qxresearch) | ||
* <a href = "mailto: [email protected]">email</a> me your GitHub id (**subject**: GitHub id @qxresearch) | ||
|
||
|
||
<h3 align="center"></h3> | ||
|
||
<p align="center"> | ||
<br> | ||
<br/> | ||
<a href="https://youtu.be/JOx_c7ehwKI">View Demo</a> | ||
· | ||
<a href="https://github.com/qxresearch/qxresearch-event-1/issues">Report Bug</a> | ||
· | ||
<a href="https://github.com/qxresearch/qxresearch-event-1/issues">Request Feature</a> | ||
<br> | ||
<br /> | ||
</p> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import pyshorteners | ||
from urllib.request import urlopen | ||
|
||
def link_shortener(link): | ||
shortener = pyshorteners.Shortener() #class object | ||
short_link = shortener.tinyurl.short(link) #shorting the link | ||
|
||
#Display | ||
print('\t[+] Real Link: ' + link) | ||
print('\t[+] Shortened Link: ' + short_link) | ||
|
||
def link_opener(link): | ||
|
||
shortenedUrl = urlopen(link) | ||
reallink = shortenedUrl.geturl() #getting real link | ||
|
||
# Display | ||
print('\t[+] Shortened Link: ' + link) | ||
print('\t[+] Real Link: ' + reallink) | ||
|
||
if __name__ == '__main__' : | ||
|
||
num = input("Enter your choice ...\n" | ||
"1. Type 1 for shortening link\n" | ||
"2. Type 2 for extrcting real link from a shorten link\n") | ||
|
||
link = input("Enter the link: ") | ||
|
||
if (num == '1') : | ||
link_shortener(link) | ||
else : | ||
link_opener(link) |