changeset 299:d5ac851f3225

[moefetch] User agent, referer.
author Edho Arief <edho@myconan.net>
date Thu, 09 Feb 2012 08:47:47 +0700
parents a872c40368dd
children 4879900244f7
files bin/moefetch
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bin/moefetch	Thu Feb 09 08:30:09 2012 +0700
+++ b/bin/moefetch	Thu Feb 09 08:47:47 2012 +0700
@@ -114,11 +114,12 @@
 Fetching XML file"
 	tempnum=1000
 	iternum=1
+	useragent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0"
 	> "${TEMP_PREFIX}-list"
 	while [ "${tempnum}" -ge 1000 ]; do
 		url="http://${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" -e continue=off || Err_Fatal "Failed download catalog file"
+		wget --quiet "${url}" -O "${TEMP_PREFIX}-xml" --referer="http://${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"