mirror of
https://github.com/Alvin-Zilverstand/Twitter-X-Media-Batch-Downloader.git
synced 2026-11-30 18:17:59 +01:00
v4.4
This commit is contained in:
1 parent
8cbf7c979b
commit
4794fac099
80 files changed
+7500
-10133
No files matched your search
+4
-9
@@ -10,21 +10,18 @@ import (
|
||||
)
|
||||
|
||||
func GetDefaultDownloadPath() string {
|
||||
// Get user's home directory
|
||||
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
// Fallback to Public Pictures if can't get home dir
|
||||
|
||||
return "C:\\Users\\Public\\Pictures"
|
||||
}
|
||||
|
||||
// Return path to user's Pictures folder
|
||||
return filepath.Join(homeDir, "Pictures")
|
||||
}
|
||||
|
||||
// GetProxyURL gets proxy URL from environment variables or custom proxy setting
|
||||
// Priority: customProxy > HTTP_PROXY/HTTPS_PROXY > http_proxy/https_proxy
|
||||
func GetProxyURL(customProxy string) (*url.URL, error) {
|
||||
// First, check custom proxy setting
|
||||
|
||||
if customProxy != "" {
|
||||
proxyURL, err := url.Parse(customProxy)
|
||||
if err != nil {
|
||||
@@ -33,7 +30,6 @@ func GetProxyURL(customProxy string) (*url.URL, error) {
|
||||
return proxyURL, nil
|
||||
}
|
||||
|
||||
// Check environment variables (case-insensitive on Windows)
|
||||
proxyEnv := os.Getenv("HTTPS_PROXY")
|
||||
if proxyEnv == "" {
|
||||
proxyEnv = os.Getenv("https_proxy")
|
||||
@@ -53,10 +49,9 @@ func GetProxyURL(customProxy string) (*url.URL, error) {
|
||||
return proxyURL, nil
|
||||
}
|
||||
|
||||
return nil, nil // No proxy
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// CreateHTTPClient creates an HTTP client with proxy support
|
||||
func CreateHTTPClient(customProxy string, timeout time.Duration) (*http.Client, error) {
|
||||
proxyURL, err := GetProxyURL(customProxy)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user