ytarchive is a wonderful application that has helped me download a bunch of important livestreams. Thanks for your work!
Motivation
I'm from China. Due to the Great Firewall, the YouTube users from mainland China have to use proxies to watch or download videos. Currently, when using this application, to make it connect to YouTube, a VPN software or an proxy environment variable like HTTPS_PROXY is required. I think a built-in command line option would make things easier.
This pull request may resolve #35.
Changes
I generally:
Changed main.go to read the --proxy option and pass it into *http.Client. Since this requires exposing an initialize function for the client variable in util.go, I changed the DefaultClient() function in util.go to InitializeHttpClient(proxyUrl *url.URL) and call it in main.go.
Added the syntax and example in the README.md file and the help message.
Fixed a typo by the way.
Test
I tested it myself and invited some friends to test it. The result on my computer is:
We can see that without the --proxy option, the application can't connect to YouTube. After specifying a proxy, it connects to the YouTube API and downloads video smoothly.
This looks good. I have some local changes I need to test on a Windows install first before I'll merge this in, and I'm not sure when I'll get to that since I am peak lazy.
Thanks for the PR.
First of all
ytarchive
is a wonderful application that has helped me download a bunch of important livestreams. Thanks for your work!Motivation
I'm from China. Due to the Great Firewall, the YouTube users from mainland China have to use proxies to watch or download videos. Currently, when using this application, to make it connect to YouTube, a VPN software or an proxy environment variable like
HTTPS_PROXY
is required. I think a built-in command line option would make things easier.This pull request may resolve #35.
Changes
I generally:
main.go
to read the--proxy
option and pass it into*http.Client
. Since this requires exposing an initialize function for theclient
variable inutil.go
, I changed theDefaultClient()
function inutil.go
toInitializeHttpClient(proxyUrl *url.URL)
and call it inmain.go
.Test
I tested it myself and invited some friends to test it. The result on my computer is:
We can see that without the
--proxy
option, the application can't connect to YouTube. After specifying a proxy, it connects to the YouTube API and downloads video smoothly.No bug was reported by my friends.