Skip to content

Instantly share code, notes, and snippets.

@gaga5lala
Last active February 28, 2019 09:02
Show Gist options
  • Save gaga5lala/eb8f45797ccf67ffd0353ebf3f29a7fc to your computer and use it in GitHub Desktop.
Save gaga5lala/eb8f45797ccf67ffd0353ebf3f29a7fc to your computer and use it in GitHub Desktop.
# ref: https://blog.huli.tw/2017/09/03/moving-from-logdown-to-hexo/
declare -a articles=(
# public: "/account/posts/#{digit}-{title}"/raw
# draft: "/account/posts/#{digit}"/raw
"/account/posts/111111-title1/raw"
"/account/posts/222222/raw"
)
declare -a unsaved_articles=()
declare -a saved_articles=()
echo "articles count: ${#articles[@]}"
for i in "${articles[@]}"
do
url="http://logdown.com"${i}
name=`echo $url | sed "s/.*posts\///g" | sed "s/\/raw//g"`
wget --heade="Cookie:_logdown_session=280e9d42edbc0ed0a5e472aab31ea77f;" $url -O $name".md"
if [[ -f "$name.md" ]]; then
saved_articles+=($name)
else
unsaved_articles+=($name)
fi
done
echo "saved count: ${#saved_articles[@]}"
echo "unsaved count: ${#unsaved_articles[@]}"
echo "${unsaved_articles[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment