Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Work around broken behaviour in aria2 async DNS

The async DNS implementation in aria2 does not support dual stack
properly. This works around that (by disabling async DNS when it
is available).

Closes #1.
  • Loading branch information...
commit 2d7c33483b1e679933c30d0be0275df52012e47c 1 parent e0fa027
@tobbez authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 youtube-dl-aria
View
9 youtube-dl-aria
@@ -4,12 +4,19 @@ UA=`youtube-dl --dump-user-agent`
TMPDIR=`mktemp -d`
COOKIES="$TMPDIR/cookies"
+ARIA_DNS_FLAGS=""
+aria2c -h#all|grep -- '--async-dns' >/dev/null 2>&1
+if [ $? -eq 0 ]
+then
+ ARIA_DNS_FLAGS="--async-dns=false"
+fi
+
VIDEO_DATA=`youtube-dl -o "[%(upload_date)s][%(id)s] %(title)s (by %(uploader)s).%(ext)s" --get-url --get-filename --cookies=${COOKIES} "$@"`
FILENAME=`echo "$VIDEO_DATA" | tail -n 1 | tr ":\"" ";'" | tr -d "\\\/*?<>|"`
URL=`echo "$VIDEO_DATA" | head -n 1`
echo "$FILENAME"
-aria2c --enable-async-dns6 -j 3 -x 3 -s 3 -k 1M --load-cookies="$COOKIES" -U "$UA" -o "$FILENAME" "$URL"
+aria2c $ARIA_DNS_FLAGS -j 3 -x 3 -s 3 -k 1M --load-cookies="$COOKIES" -U "$UA" -o "$FILENAME" "$URL"
rm -r "$TMPDIR"
Please sign in to comment.
Something went wrong with that request. Please try again.