This commit is contained in:
Sridhar Ratnakumar 2025-11-10 15:11:59 -05:00
parent af9786a87e
commit 10abd464ea
2 changed files with 14 additions and 19 deletions

View file

@ -19,7 +19,13 @@ User wants to:
## Workflow
Extract article content and save it:
```bash
@article-extractor@ "$URL"
CONTENT=$(@article-extractor@ "$URL")
```
Then use the Write tool to save `$CONTENT` to the desired location with an appropriate filename.
The script outputs clean markdown content to stdout. You decide where and how to save it based on the user's request.

View file

@ -1,6 +1,5 @@
{ writeShellApplication, curl, reader }:
# Inspired by https://github.com/michalparkola/tapestry-skills-for-claude-code/blob/main/article-extractor/SKILL.md
writeShellApplication {
name = "article-extractor";
@ -9,26 +8,16 @@ writeShellApplication {
text = ''
URL="$1"
# Create unique temp file
TEMP_HTML=$(mktemp)
# Download HTML
curl -L "$URL" > /tmp/temp.html
curl -s -L "$URL" > "$TEMP_HTML"
# Extract article
reader /tmp/temp.html > /tmp/temp.txt
# Get title from first line
TITLE=$(head -n 1 /tmp/temp.txt | sed 's/^# //')
# Clean filename
FILENAME=$(echo "$TITLE" | tr '/:?"<>| ' '-' | cut -c 1-80 | sed 's/-*$//')".txt"
# Save
mv /tmp/temp.txt "/tmp/$FILENAME"
# Extract and output article to stdout
reader "$TEMP_HTML"
# Clean up
rm /tmp/temp.html
# Show preview
echo " Saved: /tmp/$FILENAME"
head -n 10 "/tmp/$FILENAME"
rm "$TEMP_HTML"
'';
}