Note: You are viewing an old version of this page. View the current version.

e621_post_to_link() {
  post="${1}"
  wget -qO- "http://www.e621.net/post/show/${1}" | sed -e '/class="original-file-unchanged"/!d; s/^.* href="//g; s/" class=".*$//g'
}

e621_download_post() {
  post="${1}"
  url="$(e621_post_to_link "${post}")"
  file="${2:-$(echo "${url}" | sed -e 's/\?.*$//; s/^.*\/\([^\/]*\)$/\1/')}"
  wget -O "${file}" "${url}"
}