Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
X64
Commits
943b6974
Commit
943b6974
authored
Jul 25, 2023
by
大地缸
Browse files
lazydog
parent
6131bf55
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
0 deletions
+46
-0
dy/dy
dy/dy
+0
-0
dy/go.mod
dy/go.mod
+3
-0
dy/main.go
dy/main.go
+42
-0
dy/readme.md
dy/readme.md
+1
-0
No files found.
dy/dy
0 → 100755
View file @
943b6974
File added
dy/go.mod
0 → 100644
View file @
943b6974
module dy
go 1.20
dy/main.go
0 → 100644
View file @
943b6974
package
main
import
(
"fmt"
"io"
"net/http"
"os"
)
func
DownloadDouyinVideo
(
url
string
,
filename
string
)
error
{
response
,
err
:=
http
.
Get
(
url
)
if
err
!=
nil
{
return
err
}
defer
response
.
Body
.
Close
()
file
,
err
:=
os
.
Create
(
filename
)
if
err
!=
nil
{
return
err
}
defer
file
.
Close
()
_
,
err
=
io
.
Copy
(
file
,
response
.
Body
)
if
err
!=
nil
{
return
err
}
return
nil
}
func
main
()
{
videoURL
:=
"https://www.douyin.com/video/7225813424251473163"
// Replace with the actual video URL
filename
:=
"video.mp4"
// Replace with the desired filename
err
:=
DownloadDouyinVideo
(
videoURL
,
filename
)
if
err
!=
nil
{
fmt
.
Println
(
"Error downloading video:"
,
err
)
return
}
fmt
.
Println
(
"Video downloaded successfully!"
)
}
dy/readme.md
0 → 100644
View file @
943b6974
it doesn't work yet!
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment