Mercurial > ec-dotfiles
comparison 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 |
comparison
equal
deleted
inserted
replaced
322:799d3bd1bfa1 | 323:3bb8d53b61dc |
---|---|
120 Fetching XML file" | 120 Fetching XML file" |
121 tempnum=1000 | 121 tempnum=1000 |
122 iternum=1 | 122 iternum=1 |
123 > "${TEMP_PREFIX}-list" | 123 > "${TEMP_PREFIX}-list" |
124 while [ "${tempnum}" -ge 1000 ]; do | 124 while [ "${tempnum}" -ge 1000 ]; do |
125 url="http://${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${iternum}" | 125 url="${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${iternum}" |
126 [ ${_use_login} -eq 1 ] && url="${url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}" | 126 [ ${_use_login} -eq 1 ] && url="${url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}" |
127 wget --quiet "${url}" -O "${TEMP_PREFIX}-xml" --referer="http://${SITE}/post" --user-agent="${useragent}" -e continue=off || Err_Fatal "Failed download catalog file" | 127 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" |
128 printf "Processing XML file... " | 128 printf "Processing XML file... " |
129 # xslt evilry | 129 # xslt evilry |
130 xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(http.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist" | 130 xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(https?.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist" |
131 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | 131 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
132 <xsl:output method="xml" indent="yes"/> | 132 <xsl:output method="xml" indent="yes"/> |
133 <xsl:template match="post"> | 133 <xsl:template match="post"> |
134 <xsl:value-of select="@file_url" /> | 134 <xsl:value-of select="@file_url" /> |
135 </xsl:template> | 135 </xsl:template> |
307 if [ "$(grep -c . "${TEMP_PREFIX}-newlist")" -eq 0 ]; then | 307 if [ "$(grep -c . "${TEMP_PREFIX}-newlist")" -eq 0 ]; then |
308 echo "No new file" | 308 echo "No new file" |
309 else | 309 else |
310 printf "Downloading files... " | 310 printf "Downloading files... " |
311 cd "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}" | 311 cd "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}" |
312 wget -e continue=on -i "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" --referer="http://${SITE}/post" --user-agent="${useragent}" | 312 wget --no-check-certificate -e continue=on -i "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" --referer="${SITE}/post" --user-agent="${useragent}" |
313 fi | 313 fi |
314 } | 314 } |
315 | 315 |
316 # initialize base variables and initial command check | 316 # initialize base variables and initial command check |
317 init() | 317 init() |