Skip to content

Instantly share code, notes, and snippets.

@rgchris
Last active December 14, 2015 12:48
Show Gist options
  • Save rgchris/5088457 to your computer and use it in GitHub Desktop.
Save rgchris/5088457 to your computer and use it in GitHub Desktop.
Build a feed of questions AND answers from Stack Overflow 'most active' feed.
REBOL [
Title: "Stack Overflow Rebol Questions/Answers"
Date: 16-Feb-2013
Author: "Christopher Ross-Gill"
Options: [
AltXML: http://reb4.me/r3/altxml
Questions: http://stackoverflow.com/feeds/tag/rebol
Feed: http://-feed-location-/so.feed
]
]
options: construct system/script/header/options
do options/altxml
use [feed answers][
feed: load-xml/dom options/questions
answers: collect [
answers: feed/get-by-tag <entry>
clear skip answers 8 ; only the eight most active questions
foreach question answers [
if question: find/match question/get <id> http://stackoverflow.com/q/ [
question: load-xml/dom join http://stackoverflow.com/feeds/question/ question
foreach answer question/get-by-tag <entry> [
keep answer/tree
]
]
]
]
insert clear feed/find-element <entry> answers
foreach link feed/get-by-tag <link> [
if "self" = link/get #rel [
insert clear link/get #href options/feed
]
]
feed/flatten
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment