diff bin/moefetch @ 323:3bb8d53b61dc

[moefetch] Support for https.
author Edho Arief <edho@myconan.net>
date Sun, 18 Mar 2012 13:21:02 +0700
parents 110d50856dde
children 391f2b64900e
line wrap: on
line diff
--- a/bin/moefetch	Sun Mar 18 13:16:54 2012 +0700
+++ b/bin/moefetch	Sun Mar 18 13:21:02 2012 +0700
@@ -122,12 +122,12 @@
 	iternum=1
 	> "${TEMP_PREFIX}-list"
 	while [ "${tempnum}" -ge 1000 ]; do
-		url="http://${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${iternum}"
+		url="${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${iternum}"
 		[ ${_use_login} -eq 1 ] && url="${url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}"
-		wget --quiet "${url}" -O "${TEMP_PREFIX}-xml" --referer="http://${SITE}/post" --user-agent="${useragent}" -e continue=off || Err_Fatal "Failed download catalog file"
+		wget --no-check-certificate --quiet "${url}" -O "${TEMP_PREFIX}-xml" --referer="${SITE}/post" --user-agent="${useragent}" -e continue=off || Err_Fatal "Failed download catalog file"
 		printf "Processing XML file... "
 		# xslt evilry
-		xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(http.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist"
+		xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(https?.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist"
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="xml" indent="yes"/>
 <xsl:template match="post">
@@ -309,7 +309,7 @@
 	else
 		printf "Downloading files... "
 		cd "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}"
-		wget -e continue=on -i "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" --referer="http://${SITE}/post" --user-agent="${useragent}"
+		wget --no-check-certificate -e continue=on -i "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" --referer="${SITE}/post" --user-agent="${useragent}"
 	fi
 }