Hacker News Classics on a single Jekyll website (to be converted to an EBook)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
505 B

<?php
mkdir("_stories");
$stories = json_decode(file_get_contents("stories.json"), true);
foreach ($stories as $year => $yearlyStories) {
foreach ($yearlyStories as $story) {
$id = $story['objectID'];
$url = urlencode($story['url']);
$file = "_stories/$year/$id.md";
if (!file_exists($file))
{
mkdir("_stories/$year");
echo "[DL-$year] $url" . PHP_EOL;
$markdown = file_get_contents("http://heckyesmarkdown.com/go/?u=$url");
file_put_contents($file, $markdown);
}
}
}