Compare commits
2 Commits
b7455e32e1
...
0af64e435c
Author | SHA1 | Date | |
---|---|---|---|
|
0af64e435c | ||
|
b7def95490 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,3 +21,6 @@
|
||||
# Go workspace file
|
||||
go.work
|
||||
|
||||
Docker/mariadb/mysql
|
||||
|
||||
app/cache
|
BIN
app/cache/BMeVgXfPVms.mp4
vendored
Normal file
BIN
app/cache/BMeVgXfPVms.mp4
vendored
Normal file
Binary file not shown.
BIN
app/cache/DHvZLI7Db8E.mp4
vendored
Normal file
BIN
app/cache/DHvZLI7Db8E.mp4
vendored
Normal file
Binary file not shown.
BIN
app/cache/HzqnQThFSX8.mp4
vendored
Normal file
BIN
app/cache/HzqnQThFSX8.mp4
vendored
Normal file
Binary file not shown.
BIN
app/cache/K0ud8KGYlwU.mp4
vendored
Normal file
BIN
app/cache/K0ud8KGYlwU.mp4
vendored
Normal file
Binary file not shown.
BIN
app/cache/XgxmjOSIIDg.mp4
vendored
Normal file
BIN
app/cache/XgxmjOSIIDg.mp4
vendored
Normal file
Binary file not shown.
BIN
app/cache/qGNtQpAVXgg.mp4
vendored
Normal file
BIN
app/cache/qGNtQpAVXgg.mp4
vendored
Normal file
Binary file not shown.
BIN
app/cache/s6gSETiHzss.mp4
vendored
Normal file
BIN
app/cache/s6gSETiHzss.mp4
vendored
Normal file
Binary file not shown.
@ -3,6 +3,7 @@ module gitea.voser.cloud/Golang/GoDown
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/gin-contrib/cors v1.3.1
|
||||
github.com/gin-gonic/gin v1.7.7
|
||||
github.com/go-sql-driver/mysql v1.6.0
|
||||
github.com/kkdai/youtube/v2 v2.7.11
|
||||
|
11
app/go.sum
11
app/go.sum
@ -66,8 +66,11 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
|
||||
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
|
||||
github.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA=
|
||||
github.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
|
||||
github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs=
|
||||
github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
@ -75,8 +78,10 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
||||
@ -151,6 +156,7 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
@ -167,10 +173,12 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
|
||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
|
||||
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
@ -327,6 +335,7 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@ -518,6 +527,8 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
|
||||
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
|
||||
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/vansante/go-ffprobe.v2 v2.0.3 h1:nmR7yLalb5p5UmXhXUYnrsIkbb8j7h2OYMDoLETCQ5U=
|
||||
|
15
app/main.go
15
app/main.go
@ -3,9 +3,11 @@ package main
|
||||
import (
|
||||
"database/sql"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"gitea.voser.cloud/Golang/GoDown/handlers/api"
|
||||
"gitea.voser.cloud/Golang/GoDown/handlers/sqldb"
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
@ -43,6 +45,19 @@ func main() {
|
||||
sqldb.Dbentrycount()
|
||||
|
||||
router := gin.Default()
|
||||
router.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"*"},
|
||||
AllowMethods: []string{"GET", "POST", "PUT"},
|
||||
AllowHeaders: []string{"Origin"},
|
||||
// ExposeHeaders: []string{"Content-Length"},
|
||||
AllowCredentials: true,
|
||||
// AllowOriginFunc: func(origin string) bool {
|
||||
// return origin == "http://127.0.0.1:5555"
|
||||
// //return origin == "https://github.com"
|
||||
// },
|
||||
MaxAge: 5 * time.Minute,
|
||||
}))
|
||||
router.StaticFile("/favicon.ico", "./resources/favicon.ico")
|
||||
router.GET("/api/db", api.GET_api_db)
|
||||
router.GET("/api/add/:ytid", api.GET_api_add_ytid)
|
||||
router.GET("/api/get/:ytid", api.GET_api_get_ytid)
|
||||
|
BIN
app/resources/favicon.ico
Normal file
BIN
app/resources/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
4
makefile
4
makefile
@ -1,4 +1,4 @@
|
||||
all: docker prerequesits gorunapp
|
||||
all: docker prerequesits sass gorunapp
|
||||
|
||||
docker:
|
||||
docker-compose -f Docker/compose.yml up -d
|
||||
@ -13,3 +13,5 @@ clean:
|
||||
docker-compose -f Docker/compose.yml down
|
||||
sudo rm ./app/cache -rf
|
||||
sudo rm ./Docker/mariadb/mysql/* -rf
|
||||
sass:
|
||||
sass --watch ./webui/css/index.scss:./webui/css/index.css &
|
@ -62,7 +62,7 @@ button {
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 30%;
|
||||
width: auto;
|
||||
padding: 1em;
|
||||
padding-left: 4em;
|
||||
box-sizing: border-box;
|
||||
|
@ -69,7 +69,7 @@ button {
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 30%;
|
||||
width: auto;
|
||||
padding: 1em;
|
||||
padding-left: 4em;
|
||||
box-sizing: border-box;
|
||||
|
@ -8,7 +8,11 @@
|
||||
<link rel="stylesheet" href="css/index.css"
|
||||
</head>
|
||||
<body>
|
||||
<script src="js/index.js"></script>
|
||||
<!--
|
||||
<script type="application/dart" src="index.dart"></script>
|
||||
<script src="packages/browser/dart.js"></script>
|
||||
-->
|
||||
<script src="index.js"></script>
|
||||
<h1>Video Downloader</h1>
|
||||
<center>
|
||||
<form id="DownloadForm">
|
||||
|
38
webui/index.js
Normal file
38
webui/index.js
Normal file
@ -0,0 +1,38 @@
|
||||
// https://www.youtube.com/watch?v=HzqnQThFSX8&list=RDHzqnQThFSX8&start_radio=1
|
||||
function ytdl() {
|
||||
var ytid = "";
|
||||
var url = document.getElementById("url").value;
|
||||
if (url === "") {
|
||||
alert("Please enter a URL");
|
||||
return;
|
||||
}
|
||||
if (url.includes("youtube.com/watch?v=")) {
|
||||
var ytid_prep1 = url.split("=");
|
||||
if (ytid_prep1[1].includes("&")) {
|
||||
var ytid_prep2 = ytid_prep1[1].split("&");
|
||||
var ytid = ytid_prep2[0];
|
||||
}
|
||||
else {
|
||||
var ytid = ytid_prep1[1];
|
||||
}
|
||||
}
|
||||
else if (url.includes("youtu.be/")) {
|
||||
var ytid_prep1 = url.split(".be/");
|
||||
var ytid = ytid_prep1[1];
|
||||
}
|
||||
else {
|
||||
alert("URL is not compliant with this website - I am kinda sorry(Just kidding)");
|
||||
}
|
||||
console.log(ytid);
|
||||
add_db(ytid);
|
||||
return;
|
||||
}
|
||||
|
||||
function add_db(ytid) {
|
||||
const base_url = "http://127.0.0.1:8000/api/get/";
|
||||
var url = base_url.concat(ytid);
|
||||
console.log(url);
|
||||
fetch(url).then(res => res.json()).then(data => console.log(data));
|
||||
//.catch(res => console.log("Failed: " + res))
|
||||
return;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
// https://www.youtube.com/watch?v=HzqnQThFSX8&list=RDHzqnQThFSX8&start_radio=1
|
||||
console.log("Log test");
|
||||
|
||||
function ytdl(){
|
||||
var url = document.getElementById("url");
|
||||
if(url.value === ""){
|
||||
alert("Please enter a URL")
|
||||
return
|
||||
}
|
||||
console.log(url.value);
|
||||
if(url.value.includes("youtube.com/watch?v=")){
|
||||
var ytid_prep1 = url.value.split("=");
|
||||
if(ytid_prep1[1].includes("&")){
|
||||
var ytid_prep2 = ytid_prep1[1].split("&");
|
||||
var ytid = ytid_prep2[0];
|
||||
} else {
|
||||
var ytid = ytid_prep1[1];
|
||||
}
|
||||
} else if(url.value.includes("youtu.be/")){
|
||||
var ytid_prep1 = url.value.split(".be/");
|
||||
var ytid = ytid_prep1[1];
|
||||
} else {
|
||||
alert("URL is not compliant with this website - I am kinda sorry(Just kidding)")
|
||||
}
|
||||
console.log(ytid);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user