Created
January 14, 2023 18:53
-
-
Save LupusMichaelis/807e660c7c2d47e7511fe5a3536c377b to your computer and use it in GitHub Desktop.
Getting article as markdown from dev.to for Cassidoo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dependencies: | |
# apt install curl libxml2-utils python3-html2text | |
set -euo pipefail | |
shopt -s lastpipe | |
# destination repository. For example, the path to your obsidian vault | |
declare -r dest=~/tmp/cassidoo-gems | |
declare article | |
declare title | |
mkdir -p "$dest" | |
curl https://dev.to/feed/cassidoo | | |
xmllint --xpath '//channel/item/link/text()' - | | |
while read article | |
do | |
title=$(printf '%b' "$article" | awk -F/ '{ print $5 }') | |
curl "$article" | | |
xmllint --html --xpath '//div[@class="crayons-article__main"]' - | | |
html2markdown > "$dest/$title.md" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MIT license