comparison bin/moefetch @ 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
comparison
equal deleted inserted replaced
298:a872c40368dd 299:d5ac851f3225
112 Generate_Link() { 112 Generate_Link() {
113 echo " 113 echo "
114 Fetching XML file" 114 Fetching XML file"
115 tempnum=1000 115 tempnum=1000
116 iternum=1 116 iternum=1
117 useragent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0"
117 > "${TEMP_PREFIX}-list" 118 > "${TEMP_PREFIX}-list"
118 while [ "${tempnum}" -ge 1000 ]; do 119 while [ "${tempnum}" -ge 1000 ]; do
119 url="http://${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${iternum}" 120 url="http://${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${iternum}"
120 [ ${_use_login} -eq 1 ] && url="${url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}" 121 [ ${_use_login} -eq 1 ] && url="${url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}"
121 wget --quiet "${url}" -O "${TEMP_PREFIX}-xml" -e continue=off || Err_Fatal "Failed download catalog file" 122 wget --quiet "${url}" -O "${TEMP_PREFIX}-xml" --referer="http://${SITE}/post" --user-agent="${useragent}" -e continue=off || Err_Fatal "Failed download catalog file"
122 printf "Processing XML file... " 123 printf "Processing XML file... "
123 # xslt evilry 124 # xslt evilry
124 xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(http.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist" 125 xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(http.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist"
125 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 126 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
126 <xsl:output method="xml" indent="yes"/> 127 <xsl:output method="xml" indent="yes"/>