Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflecting changes in base repo to the organization repo #1

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vs/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## MIT License

Copyright (c) 2018 Pranjal Rastogi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web gunicorn app:app
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Domain-Explorer
Input any URL and all the links on web-page, types of domains, their count and sizeof web-page will be revealed.
# Domain-Explorer<hr>
<strong>Deployed at</strong>: https://domain-explorer.herokuapp.com/<br>
<strong> View About it at:</strong> https://prankshaw.github.io/Domain-Explorer/<br>
Input any URL and all the links on web-page, types of domains, their count and sizeof web-page will be revealed.<br>
<strong>Youtube Video:</strong> https://youtu.be/xEHceTdiZSA
## See it Working!
Just download the script(.py) file and run it in your favorite IDE or terminal supporting Python 3.x. To download python visit https://www.python.org/downloads/ and then run the script

### Screenshot 1
![Screenshot1](task_opengenus_1.jpg)

### Screenshot 2
![Screenshot2](task_opengenus-2.jpg)
![Gif1](domainexplorer.gif)
<br>Just download the script(.py) file and run it in your favorite IDE supporting Python 3.x. To download python visit https://www.python.org/downloads/ and pip all the requirements then run the script by moving to this folder and typing in terminal- <strong>python app.py</strong>
# License
Licensed under MIT-license
https://prankshaw.mit-license.org/


1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-architect
47 changes: 47 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from flask import Flask, render_template, request, url_for
from wtforms import Form, FloatField, validators
import urllib.request #Importing necessary libraries
from urllib.parse import urlparse
from bs4 import BeautifulSoup


app = Flask(__name__)

@app.route('/')
def my_form():
return render_template('form.html')

@app.route('/my_form_post', methods=['GET','POST'])
def my_form_post():
your_list= [1,2,3,4]
url = request.form['variable']
page = urllib.request.urlopen(url)
s = len(page.read())
#s=str(s)

links=[]
domains=[]
page = urllib.request.urlopen(url)
soup = BeautifulSoup(page ,'html.parser')

for link in soup.find_all('a'):
links.append(link.get('href')) #Adding all links to list named "Links"
parsed_uri = urlparse(link.get('href')) #Parsing the URL for domain name
domains.append('{uri.scheme}://{uri.netloc}/'.format(uri=parsed_uri)) #Appending parse url to list named "Domains"

link_size=len(links)

count_dict = {i:domains.count(i) for i in domains}


return render_template('output.html', s=s,links=links,count_dict=count_dict,link_size=link_size)

@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404


if __name__ == '__main__':
app.run(debug=False)


Binary file added domainexplorer.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Binary file added images/flask_initial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flask_output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added images/weblogo.ico
Binary file not shown.
12 changes: 12 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
beautifulsoup4==4.8.1
bs4==0.0.1
Click==7.0
Flask==1.1.1
gunicorn==19.9.0
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
soupsieve==1.9.4
urllib3==1.25.6
Werkzeug==0.16.0
WTForms==2.2.1
88 changes: 88 additions & 0 deletions static/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
body {
margin: 0;
padding: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #444;
}

/*
* Formatting the header area
*/
header {
background-color: #DFB887;
height: 35px;
width: 100%;
opacity: .9;
margin-bottom: 10px;
}

header h1.logo {
margin: 0;
font-size: 1.7em;
color: #fff;
text-transform: uppercase;
float: left;
}

header h1.logo:hover {
color: #fff;
text-decoration: none;
}

/*
* Centering the body content
*/
.container {
width: 1200px;
margin: 0 auto;
}

div.home {
padding: 10px 0 30px 0;
background-color: #E6E6FA;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}

div.about {
padding: 10px 0 30px 0;
background-color: #E6E6FA;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}

h2 {
font-size: 3em;
margin-top: 40px;
text-align: center;
letter-spacing: -2px;
}

h3 {
font-size: 1.7em;
font-weight: 100;
margin-top: 30px;
text-align: center;
letter-spacing: -1px;
color: #999;
}

.menu {
float: right;
margin-top: 8px;
}

.menu li {
display: inline;
}

.menu li+li {
margin-left: 35px;
}

.menu li a {
color: #444;
text-decoration: none;
}
21 changes: 21 additions & 0 deletions templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends 'base.html' %}

{% block title %}

Page Not Found

{% endblock %}


{% block body %}

<h1 style="text-align: center;">404 Error :(</h1>
<p style=" padding: 10px; font-size: 20px;">What you were looking for is just not there.<p>
<a href="{{ url_for('my_form') }}"
style="background-color: black; border-radius: 24px; border-color: chartreuse; color: chartreuse; font-size: 16px; padding: 5px; margin: 10px;"
onmouseover="
this.style.backgroundColor='chartreuse' ;this.style.color='black' ;this.style.fontSize='18px' ;"
onmouseout="this.style.backgroundColor='black';this.style.color='chartreuse';this.style.fontSize='16px';">Go
somewhere nice!! </a>

{% endblock %}
27 changes: 27 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
<meta charset="utf-8">
<title>{% block title %} {% endblock %}</title>
<link rel="shortcut icon" href="images/weblogo.ico" type="image/x-icon">
<link rel="stylesheet" href="{{ url_for('static', filename='main.css') }}">
{% block head %} {% endblock %}
</head>

<body>
<header
style="position: fixed;left: 0;top: 0;width: 100%;background-color: red;text-align: center; text-align: center; size: 44px;">
<strong> Welcome to Website Analyzer</strong> {% block header %} {% endblock %} </header>
</br>

{% block body %} {% endblock %}

<footer
style="position: fixed;left: 0;bottom: 0;width: 100%;background-color: black;text-align: center;padding: 12px;">
<strong> Thank You for
Visiting!! Made by <a target="blank" href="https://prankshaw.github.io" style="font-size: 14px;"> Pranjal
Rastogi</a></strong></footer>
</body>

</html>
31 changes: 31 additions & 0 deletions templates/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{% extends 'base.html' %}

{% block title %}
Form
{% endblock %}


{% block head %}

{% endblock %}


{% block body %}
<div
style="background-color: black; color: white; font-size: 24px; font-family: Arial, Helvetica, sans-serif; padding: 20px; text-align: center;">
<p> Input any URL and all the links on web-page, types of domains, their count and size of web-page will be
revealed.</p>
</div>
<br>
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 34px; text-align: center;">Enter URL to be analyzed </p>

<form method="POST" action="{{ url_for('my_form_post') }}" style="padding: 10px; font-size: 30px;">
Enter URL: <input name="variable" type="url">
<input type="submit"
style="background-color: black; border-radius: 24px; border-color: blueviolet; color: white; font-size: 26px; padding: 5px;"
onmouseover="
this.style.backgroundColor='blueviolet' ;this.style.color='black' ;this.style.fontSize='28px' ;"
onmouseout="this.style.backgroundColor='black';this.style.color='blueviolet';this.style.fontSize='26px';">
</form>

{% endblock %}
40 changes: 40 additions & 0 deletions templates/output.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% extends 'base.html' %}

{% block title %}
Output
{% endblock %}

{% block header %}

<button
style="background-color: white; border-radius: 24px; border-color: black; color: black; font-size: 14px; padding: 5px;"
onmouseover="
this.style.backgroundColor='black' ;this.style.color='white' ;this.style.fontSize='14px' ;"
onmouseout="this.style.backgroundColor='white';this.style.color='black';this.style.fontSize='14px';"><a
href="/"><strong>
Go back to home!! </strong></a></button>

{% endblock %}

{% block body %}

<h2> Total Size of web page is: {{ s }} bytes</h2>



<h2>Total number of links in web page are : {{link_size}}</h2>

{% for c in count_dict %}
<p> Count of domain name <strong>{{ c }}</strong> = {{count_dict[c]}} </p>
{% endfor %}

<h2>The links present are:</h2>

{% for link in links %}
<p style="font-size: 12px;">{{ link }}</p>
{% endfor %}
<br>



{% endblock %}