Compare commits

...
2 Commits
Author SHA1 Message Date
Niko Storni 2f15c920d4 speed up playlist listing 2021-06-25 19:16:01 +02:00
Niko Storni 01f6448e72 revert aria2c usage 2021-06-25 19:09:00 +02:00
3 changed files with 3 additions and 13 deletions

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ import (
)
func GetPlaylistVideoIDs(channelName string, maxVideos int, stopChan stop.Chan, pool *ip_manager.IPPool) ([]string, error) {
args := []string{"--skip-download", "https://www.youtube.com/channel/" + channelName + "/videos", "--get-id", "--flat-playlist", "--cookies", "cookies.txt"}
args := []string{"--skip-download", "https://www.youtube.com/channel/" + channelName + "/videos", "--get-id", "--flat-playlist", "--cookies", "cookies.txt", "--playlist-end", fmt.Sprintf("%d", maxVideos)}
ids, err := run(channelName, args, stopChan, pool)
if err != nil {
return nil, errors.Err(err)
+1 -3
View File
@@ -2,7 +2,6 @@ package ip_manager
import (
"net"
"os"
"sort"
"sync"
"time"
@@ -46,8 +45,7 @@ func GetIPPool(stopGrp *stop.Group) (*IPPool, error) {
var pool []throttledIP
for _, address := range addrs {
if ipnet, ok := address.(*net.IPNet); ok && ipnet.IP.IsGlobalUnicast() {
ipv6Disabled := os.Getenv("DISABLE_IPV6") != ""
if ipnet.IP.To16() != nil && govalidator.IsIPv6(ipnet.IP.String()) && !ipv6Disabled {
if ipnet.IP.To16() != nil && govalidator.IsIPv6(ipnet.IP.String()) {
pool = append(pool, throttledIP{
IP: ipnet.IP.String(),
LastUse: time.Now().Add(-5 * time.Minute),
+1 -9
View File
@@ -279,15 +279,7 @@ func (v *YoutubeVideo) download() error {
"--load-info-json",
metadataPath,
}
ipv6Disabled := os.Getenv("DISABLE_IPV6") != ""
if ipv6Disabled {
ytdlArgs = append(ytdlArgs,
"--external-downloader",
"aria2c",
"--external-downloader-args",
"aria2c:-j 16 -x 16 -s 16 -k 1M",
)
}
userAgent := []string{"--user-agent", downloader.ChromeUA}
if v.maxVideoSize > 0 {
ytdlArgs = append(ytdlArgs,