Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- requirements.txt +4 -0
- templates/video.html +148 -0
- video.py +28 -0
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
git+https://github.com/OE-LUCIFER/Webscout.git
|
| 2 |
+
requests
|
| 3 |
+
flask
|
| 4 |
+
arrow
|
templates/video.html
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>InfoHive - Video Search</title>
|
| 7 |
+
<meta name="description" content="InfoHive is a search engine that provides the latest videos on various topics.">
|
| 8 |
+
<meta property="og:title" content="InfoHive - Video Search">
|
| 9 |
+
<meta property="og:description" content="InfoHive is a search engine that provides the latest videos on various topics.">
|
| 10 |
+
<meta property="og:image" content="https://your_image_url_here.jpg">
|
| 11 |
+
<meta property="og:url" content="https://your_website_url_here.com">
|
| 12 |
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
| 13 |
+
<link rel="icon" href="favicon.ico" type="image/x-icon">
|
| 14 |
+
<style>
|
| 15 |
+
body {
|
| 16 |
+
font-family: sans-serif;
|
| 17 |
+
margin: 0;
|
| 18 |
+
background: #000;
|
| 19 |
+
color: #fff;
|
| 20 |
+
}
|
| 21 |
+
.container {
|
| 22 |
+
padding-top: 50px;
|
| 23 |
+
}
|
| 24 |
+
.jumbotron {
|
| 25 |
+
background-color: #007bff;
|
| 26 |
+
color: #fff;
|
| 27 |
+
padding: 2rem 2rem;
|
| 28 |
+
margin-bottom: 30px;
|
| 29 |
+
}
|
| 30 |
+
.card {
|
| 31 |
+
border: none;
|
| 32 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 33 |
+
transition: transform 0.3s;
|
| 34 |
+
}
|
| 35 |
+
.card:hover {
|
| 36 |
+
transform: translateY(-5px);
|
| 37 |
+
}
|
| 38 |
+
.card-title {
|
| 39 |
+
font-size: 20px;
|
| 40 |
+
font-weight: bold;
|
| 41 |
+
color: #333;
|
| 42 |
+
}
|
| 43 |
+
.card-text {
|
| 44 |
+
color: #666;
|
| 45 |
+
}
|
| 46 |
+
.card-footer {
|
| 47 |
+
background-color: #f9f9f9;
|
| 48 |
+
border-top: none;
|
| 49 |
+
}
|
| 50 |
+
.btn-primary {
|
| 51 |
+
background-color: #007bff;
|
| 52 |
+
border-color: #007bff;
|
| 53 |
+
}
|
| 54 |
+
.btn-primary:hover {
|
| 55 |
+
background-color: #0056b3;
|
| 56 |
+
border-color: #0056b3;
|
| 57 |
+
}
|
| 58 |
+
.btn-outline-primary {
|
| 59 |
+
color: #007bff;
|
| 60 |
+
border-color: #007bff;
|
| 61 |
+
}
|
| 62 |
+
.btn-outline-primary:hover {
|
| 63 |
+
background-color: #007bff;
|
| 64 |
+
color: #fff;
|
| 65 |
+
}
|
| 66 |
+
.no-results {
|
| 67 |
+
text-align: center;
|
| 68 |
+
font-style: italic;
|
| 69 |
+
margin-top: 20px;
|
| 70 |
+
}
|
| 71 |
+
.search-input {
|
| 72 |
+
border-radius: 24px;
|
| 73 |
+
}
|
| 74 |
+
.logo {
|
| 75 |
+
max-width: 200px;
|
| 76 |
+
}
|
| 77 |
+
.subscribe-btn {
|
| 78 |
+
background-color: #ff0000;
|
| 79 |
+
border-color: #ff0000;
|
| 80 |
+
}
|
| 81 |
+
.subscribe-btn:hover {
|
| 82 |
+
background-color: #cc0000;
|
| 83 |
+
border-color: #cc0000;
|
| 84 |
+
}
|
| 85 |
+
</style>
|
| 86 |
+
</head>
|
| 87 |
+
<body>
|
| 88 |
+
<div class="container">
|
| 89 |
+
<div class="jumbotron" style="margin-top: 100px;">
|
| 90 |
+
<h1 class="display-4 text-center mb-4">Explore the Latest video</h1>
|
| 91 |
+
<p class="lead text-center">InfoHive is your source for up-to-date news on technology, sports, and more.</p>
|
| 92 |
+
<div class="text-center">
|
| 93 |
+
<a href="https://youtube.com/@OEvortex" class="btn btn-primary subscribe-btn" target="_blank">Subscribe to OEvortex on YouTube</a>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
<div class="card mb-4">
|
| 97 |
+
<div class="card-body">
|
| 98 |
+
<form method="GET" action="/">
|
| 99 |
+
<div class="form-row">
|
| 100 |
+
<div class="col-md-8">
|
| 101 |
+
<input type="text" class="form-control search-input" name="keywords" placeholder="Enter keywords" value="{{ keywords }}">
|
| 102 |
+
<!-- </div> -->
|
| 103 |
+
<!-- <div class="col-md-2">
|
| 104 |
+
<select name="timelimit" class="form-control search-input">
|
| 105 |
+
<option value="d" {% if timelimit == 'd' %}selected{% endif %}>Day</option>
|
| 106 |
+
<option value="w" {% if timelimit == 'w' %}selected{% endif %}>Week</option>
|
| 107 |
+
<option value="m" {% if timelimit == 'm' %}selected{% endif %}>Month</option>
|
| 108 |
+
<option value="y" {% if timelimit == 'y' %}selected{% endif %}>year</option>
|
| 109 |
+
</select> -->
|
| 110 |
+
</div>
|
| 111 |
+
<div class="col-md-2">
|
| 112 |
+
<button type="submit" class="btn btn-primary btn-block">Search</button>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
</form>
|
| 116 |
+
</div>
|
| 117 |
+
</div>
|
| 118 |
+
{% if video %}
|
| 119 |
+
<div class="row">
|
| 120 |
+
{% for video_item in video %}
|
| 121 |
+
<div class="col-md-6 mb-4">
|
| 122 |
+
<div class="card">
|
| 123 |
+
<!-- Video Embed -->
|
| 124 |
+
<div class="embed-responsive embed-responsive-16by9">
|
| 125 |
+
{{ video_item['embed_html'] | safe }}
|
| 126 |
+
</div>
|
| 127 |
+
<!-- Video Description -->
|
| 128 |
+
<div class="card-body">
|
| 129 |
+
<h5 class="card-title">{{ video_item['title'] }}</h5>
|
| 130 |
+
<p class="card-text">{{ video_item['description'] }}</p>
|
| 131 |
+
<p class="card-text"><strong>Duration:</strong> {{ video_item['duration'] }}</p>
|
| 132 |
+
<p class="card-text"><strong>Published by:</strong> {{ video_item['publisher'] }}</p>
|
| 133 |
+
<p class="card-text"><strong>Views:</strong> {{ video_item['statistics']['viewCount'] }}</p>
|
| 134 |
+
<!-- <p class="card-text"><strong>Uploader:</strong> {{ video_item['uploader'] }}</p> -->
|
| 135 |
+
<small class="text-muted">
|
| 136 |
+
{{ video_item['published'] }} - {{ video_item['uploader'] }}
|
| 137 |
+
</small>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
{% endfor %}
|
| 142 |
+
</div>
|
| 143 |
+
{% else %}
|
| 144 |
+
<p class="no-results">No results found.</p>
|
| 145 |
+
{% endif %}
|
| 146 |
+
</div>
|
| 147 |
+
</body>
|
| 148 |
+
</html>
|
video.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, render_template, request
|
| 2 |
+
from webscout import WEBS
|
| 3 |
+
import arrow
|
| 4 |
+
|
| 5 |
+
app = Flask(__name__)
|
| 6 |
+
|
| 7 |
+
@app.route('/', methods=['GET'])
|
| 8 |
+
def home():
|
| 9 |
+
keywords = request.args.get('keywords', 'india')
|
| 10 |
+
timelimit = request.args.get('timelimit', 'y')
|
| 11 |
+
video_list = []
|
| 12 |
+
with WEBS() as webs_instance:
|
| 13 |
+
WEBS_videos_gen = webs_instance.videos(
|
| 14 |
+
keywords,
|
| 15 |
+
region="wt-wt",
|
| 16 |
+
timelimit=None,
|
| 17 |
+
safesearch="off",
|
| 18 |
+
resolution=None,
|
| 19 |
+
duration=None,
|
| 20 |
+
max_results=100
|
| 21 |
+
)
|
| 22 |
+
for r in WEBS_videos_gen:
|
| 23 |
+
r['published'] = arrow.get(r['published']).humanize()
|
| 24 |
+
video_list.append(r)
|
| 25 |
+
return render_template('video.html', video=video_list, keywords=keywords)
|
| 26 |
+
|
| 27 |
+
if __name__ == '__main__':
|
| 28 |
+
app.run(debug=True)
|