Skip to content

Use case 2: Single page with articles

Matthijs Dekker edited this page Jan 17, 2016 · 2 revisions

A page contains the complete articles. A single rest call should suffice to get a list of all articles

POST /v1/createArticleList

Example input json

{
  "url": "https://news.ycombinator.com/newcomments",
  "blockActions": [{
    "order": 1,
    "actionType": "css-selector",
    "template": "table.itemlist tbody td.default"
  }],
  "articleActions": [{
    "order": 1,
    "actionType": "css-selector",
    "template": "span.storyon",
    "outputVariable": "anchor"
  }, {
    "order": 2,
    "actionType": "css-selector",
    "template": "span.storyon a",
    "outputVariable": "title"
  }, {
    "order": 3,
    "actionType": "attribute",
    "template": "href",
    "inputputVariable": "anchor",
    "outputVariable": "uid"
  }, {
    "order": 4,
    "actionType": "css-selector",
    "template": "span.c00",
    "outputVariable": "content"
  }, {
    "order": 5,
    "actionType": "css-remove",
    "template": "div.reply",
    "inputputVariable": "content",
    "outputVariable": "content"
  }, {
    "order": 6,
    "actionType": "replace",
    "template": "<span> </span>",
    "replaceWith" : "",
    "inputputVariable": "content",
    "outputVariable": "content"
  }]
}

Example output json

[{
	"content": "Win8 and Win10 are objectively worse than 7.\n \n",
	"tags": [],
	"title": "\"...customers are likely to see regressions with W...",
	"uid": "https://news.ycombinator.com/item?id=10918462"
}, {
	"content": "Leave the pun threads on Reddit, please.\n \n",
	"tags": [],
	"title": "Why London Underground stopped people walking up t...",
	"uid": "https://news.ycombinator.com/item?id=10916704"
}, {
	"content": "Yes, I know what a straddle is, but it has almost nothing to do with the initial claim: \"Its actual value is probably unchanged.\"\n \n",
	"tags": [],
	"title": "Etsy stock has lost 76% of its value in 9 months",
	"uid": "https://news.ycombinator.com/item?id=10912225"
}, {
	"content": "I think PG highlighted pretty well the mechanisms which drove away wealth inequality in the last century. I think PG commented only on the upper end on the wealth distribution scale and was of the opinion it is not a problem. He did not comment it's ok for people to be poor. These issues are not completely linked. Economics are not a zero sum game. The wealth distribution curve can hypothetically have any shape. That it tails to ridiculous numbers in the larger end is not the problem. The problem is the price level in the society, and how the wealth distribution is spread in relation to this average level. I don't think he expressed any opinions on the shape of this distribution. And this has at least three things of concern, not one. The average price level , the shape of the wealth distribution and the total wealth in the society are all dynamic.\n<p>Anyway I read his argument as \"please ignore the tailing and focus on other things\". This is at least my interpretation and if it's correct I agree. Jealousy never hurt any one. Extreme poverty, on the other hand, is quite detrimental to an individuals life.</p> \n",
	"tags": [],
	"title": "Life is Short",
	"uid": "https://news.ycombinator.com/item?id=10917446"
}, {
	"content": "<i>The fact that they remain a trusted arbitrator for certain investor classes is concerning, because it implies that as useless as they are, they're still more competent than institutional investors.</i>\n<p>There's another interpretation: by \"trusting\" these rating agencies, institutional investors can shift the blame when the investments go wrong.</p> \n",
	"tags": [],
	"title": "Iceland sentences bankers to prison for their part...",
	"uid": "https://news.ycombinator.com/item?id=10915506"
}, {
	"content": "&gt; Filling in knowledge gaps with the the word \"aliens\" is a laughably childish approach to science in my opinion.\n<p>You are talking about probability of life in the universe based on a tv show, replace aliens with \"earth is round\" and you will see how ridiculous it sounds.</p> \n",
	"tags": [],
	"title": "Comets can't explain weird 'alien megastructure' s...",
	"uid": "https://news.ycombinator.com/item?id=10916273"
}, {
	"content": "&gt; “People ought to be entitled to what they create” is not a universally accepted principle\n<p>Yes, in all first world societies it is.</p>\n<p>Bob is a farmer. He has the same amount of land as his neighbor, but he works twice as hard, and grows twice the number of crops to sell in a year. He has twice the income. Is this income inequality bad, and would anyone reasonably claim that he's entitled to <i>none</i> of it? [1]</p>\n<p>There is a mainstream view that society has the right to tax Bob's income, so he does not receive <i>all</i> of what he creates. That's the debate: how much is fair? Maybe it's fair for Bob to have twice the income of his neighbor, or maybe less than twice as much. Unless Bob gets the <i>same</i> as his neighbor, there's income inequality because of differences in productivity.</p>\n<p>No farmer is going to singlehandedly earn a million times what his neighbor earns. However, because of technology, this is now possible in some industries. For example, Notch is a game designer, and he singlehandedly makes a game that sells 20 million copies. Notch now has a vast income that far exceeds the typical game designer. Is this bad?</p>\n<p>PG's essay points out that income inequality is a complex phenomenon, with multiple causes, some that are good (people creating amazingly valuable things) and some that are bad (\"kids with no chance of reaching their potential\"). PG's essay from my perspective serves to make the point that perhaps not <i>all</i> income equality is bad, and that there deserves to be more thought on the topic of \"how much is bad?\" or \"what causes of income inequality are bad?\", instead of treating income inequality as a one-dimensional issue that is intrinsically bad. It's not intrinsically bad: when people work hard, improve, and become more productive, they earn more.</p>\n<p>[1] There's some communist philosophy that argues he's actually entitled to none of it, but that philosophy has nothing to do with the modern economies we actually live in. Can we discuss the concrete world? PG's essay is meant to discuss the real world, not abstract philosophy.</p> \n",
	"tags": [],
	"title": "Life is Short",
	"uid": "https://news.ycombinator.com/item?id=10917446"
}, {
	"content": "You sound like an idiot. How in the world is this comparable to something oprah says?\n<p>This reminds me of how Karl Popper critiques people's opinions, at times he rejects both the pro/anti side of something, as he did in anti-naturalist history vs naturalist history arguing that <i>both</i> were based on a misunderstanding of the logical content of the thing in question.</p>\n<p>In this regard you have misunderstood the logical content of the essay in question, drawing a contrast on two things that are not.</p> \n",
	"tags": [],
	"title": "Life is Short",
	"uid": "https://news.ycombinator.com/item?id=10917446"
}, {
	"content": "You can't give a \"maybe don't read this\" spoiler warning without saying what it could spoil. This is more of a \"don't ask what book\".\n \n",
	"tags": [],
	"title": "African American Women Worked as Some of NASA's Fi...",
	"uid": "https://news.ycombinator.com/item?id=10917767"
}, {
	"content": "I think you're giving it a bit more credit than necessary. Don't get me wrong, it's cool that they've got it running on a RPi, but it's almost word for word what you'd write in C (right down to needing to inline assembly to get a busy loop to work). The C implementation wouldn't need to bring in a bleeding edge nightly build, worry about name mangling etc..\n \n",
	"tags": [],
	"title": "Raspberry Pi Bare Metal Programming with Rust",
	"uid": "https://news.ycombinator.com/item?id=10915735"
}, {
	"content": "But under rodionos' suggestion, it would: stealing bread is also a crime against wealth. Wealth is not just \"money\".\n \n",
	"tags": [],
	"title": "Iceland sentences bankers to prison for their part...",
	"uid": "https://news.ycombinator.com/item?id=10915506"
}, {
	"content": "I don't think they rename them. They make a new version that unhides the update, but it keeps the same KB number.\n \n",
	"tags": [],
	"title": "\"...customers are likely to see regressions with W...",
	"uid": "https://news.ycombinator.com/item?id=10918462"
}, {
	"content": "It’s kind of off topic, but I’m happy to answer your question:\n<p>My mother was a career elementary school teacher, and my father spent his career as an unaffiliated anthropologist, putting my family solidly in the middle class, probably at about the 60–70th percentile among American households. My godparents are indigenous rural peasants from southern Mexico, who spent their lives at approximately the global poverty line. A couple of my aunts/uncles had blue collar or restaurant/retail careers and are probably at about the 30th percentile among American households. Others are wealthy retired lawyers and engineers, among the top 5%.</p>\n<p>Can you explain how “inequality is what’s saving us”?</p>\n<p>I’m also not sure what you mean by “a specific class of people tries to get us feel bad about inequality”.</p> \n",
	"tags": [],
	"title": "Life is Short",
	"uid": "https://news.ycombinator.com/item?id=10917446"
}, {
	"content": "Please see my response to RustyNails above. I feel like you're rebutting an argument that the original poster never made.\n \n",
	"tags": [],
	"title": "African American Women Worked as Some of NASA's Fi...",
	"uid": "https://news.ycombinator.com/item?id=10917767"
}, {
	"content": "The article doesn't go so far as to say so explicitly, but it implies we're seeing spectra of gold, platinum, and uranium, among others, in gamma ray bursts. If that's the case, I don't think the \n<i>a priori</i> improbability of the story much matters.\n \n",
	"tags": [],
	"title": "The ultra-violent origins of gold",
	"uid": "https://news.ycombinator.com/item?id=10918383"
}, {
	"content": "Thanks for the nerd collide link, as its something that has been itching at the back of my mind as of late.\n \n",
	"tags": [],
	"title": "African American Women Worked as Some of NASA's Fi...",
	"uid": "https://news.ycombinator.com/item?id=10917767"
}, {
	"content": "Except cs degrees don't teach you anything about properly writing software. I've encountered plenty of graduates from top CS curriculums that couldn't code their way out of a paper bag. Understanding finite automata and formal methods does jack shit to help you write maintainable code. So your example of a 10-dev team maintaining code would apply more to a fresh CS grad's work than someone that has any experience writing software.\n \n",
	"tags": [],
	"title": "Entry Level Positions – 3 Years Experience",
	"uid": "https://news.ycombinator.com/item?id=10915253"
}, {
	"content": "Please note that I'm not the author of the presentation. Made by Quentin de Laroussilhe \n<a href=\"http://underflow.fr\" rel=\"nofollow\">http://underflow.fr</a>\n<p>I had to make a copy to my Google account to keep the slides.</p> \n",
	"tags": [],
	"title": "An introduction to Machine Learning",
	"uid": "https://news.ycombinator.com/item?id=10918613"
}, {
	"content": "For sites that really matter, don't use lastpass or any system other than memory or a written down hint system.\n \n",
	"tags": [],
	"title": "Phishing attack against Lastpass",
	"uid": "https://news.ycombinator.com/item?id=10916342"
}, {
	"content": "Security updates, etc too. PCs in the past few years have been growing more and more towards being Systems on Chips that have a few more interesting ports on them. One of the reasons MS is doing this is because the underlying hardware is changing pretty severely, so the OS needs to change to match.\n \n",
	"tags": [],
	"title": "\"...customers are likely to see regressions with W...",
	"uid": "https://news.ycombinator.com/item?id=10918462"
}, {
	"content": "The search on the windows 10 start menu is oddly broken. Really a lot of 10 is quite buggy right now.\n \n",
	"tags": [],
	"title": "\"...customers are likely to see regressions with W...",
	"uid": "https://news.ycombinator.com/item?id=10918462"
}, {
	"content": "This is also an attack that is possible against MacOS and Windows. My app can make the screen \"go dark\" or throw up an Apple-looking password prompt.\n<p>As I kept saying (and once emailed Steve Jobs about) the way to properly handle this is:</p>\n<p>1. Establish a secret phrase or icon when the account is created, that the user can recognize</p>\n<p>2. Show it in the iframe when the user places their keyboard focus into the password field</p>\n<p>3. Do not allow outside code to grab it -- in browsers, use the cross domain security model, in MacOS use the anti-DRM preventing screenshotting a certain window.</p>\n<p>Now, it's true that on the web, the secret phrase or icon has to depend on the user already having a session they've logged into. This authentication prevents an attacker from simply getting the secret phrase or icon.</p> \n",
	"tags": [],
	"title": "Phishing attack against Lastpass",
	"uid": "https://news.ycombinator.com/item?id=10916342"
}, {
	"content": "I had those experiences as a youthful nerd too. There are some fond memories and some bitter ones.\n<p>I'm not sure why you think that your experiences as a youthful nerd make some sort of point about racism and sexism in modern tech-corporate culture, though. I mean, your entire post seems like a non sequitur in the context of the post you're responding to.</p> \n",
	"tags": [],
	"title": "African American Women Worked as Some of NASA's Fi...",
	"uid": "https://news.ycombinator.com/item?id=10917767"
}, {
	"content": "\"In China, they discovered a man born with three eyes.\n<p>LensCrafters said they could make glasses for him in about an hour and a half.\"</p>\n<p>(An old Jay Leno joke. For context, LensCrafters slogan of the period was, \"Quality eyeglasses... in about an hour.\"</p> \n",
	"tags": [],
	"title": "Inside the Eye: Nature's Most Exquisite Creation",
	"uid": "https://news.ycombinator.com/item?id=10917089"
}, {
	"content": "How would it know it's a password field and not just some text input box that uses * characters?\n \n",
	"tags": [],
	"title": "Phishing attack against Lastpass",
	"uid": "https://news.ycombinator.com/item?id=10916342"
}, {
	"content": "You're using the colloquial definition of productivity while PG was using the economic definition. The economic definition has nothing to do with how hard you work--it has to do with your economic output. Bill Gates working at McDonalds would be tremendously unproductive (by the economic definition). A farmer who works the land manually is much less productive than one who uses a tractor, even though the manual laborer is probably working \"harder\" than the technology-enabled one.\n \n",
	"tags": [],
	"title": "Life is Short",
	"uid": "https://news.ycombinator.com/item?id=10917446"
}, {
	"content": "I disagree. This is an important topic in life. Too bad he published this one just after the previous ones about wealth inequality.\n<p>Having lost my parents some time ago and having two kids I can concur with his sentiments fully and can confirm they are spot on.</p>\n<p>The incentive to respond to acidic comments and trolls in online discourse is a pervasive feature of the medium - and it seldom creates any value. Thus it's a perfect example of useless bullshit. The discussions are usually ephemeral in nature - quickly forgotten - and not influential. This is not to say there are no influential discussions - but that at the heat of the moment most discussions feel more important than they really are.</p> \n",
	"tags": [],
	"title": "Life is Short",
	"uid": "https://news.ycombinator.com/item?id=10917446"
}, {
	"content": "You understate the difficulties actual people have. My parents were VERY confused and frustrated with windows 8 until I \"fixed\" it to work exactly like 7 which they could not figure out how to do on their own.\n<p>Most users don't even change defaults or even know how to find and install alternatives this is why software intended to be used by noobs really requires good defaults.</p> \n",
	"tags": [],
	"title": "\"...customers are likely to see regressions with W...",
	"uid": "https://news.ycombinator.com/item?id=10918462"
}, {
	"content": "This line of reasoning is so frustrating.\n<p>There is no reason to believe that God(s) exist. Someone who claims that they do has the burden of proof.</p>\n<p>There is also no reason to believe that we Earthlings have the universe all to ourselves. It is an extraordinary claim to suggest that we do. <i>Someone who makes such a claim also bears the burden of proof.</i></p>\n<p>The idea that gods and Type II civilizations are equally implausible is, to put it bluntly, ridiculous.</p> \n",
	"tags": [],
	"title": "Comets can't explain weird 'alien megastructure' s...",
	"uid": "https://news.ycombinator.com/item?id=10916273"
}, {
	"content": "In what way is he throwing a tantrum? He hardly writes anything at all! Human neurological uniformity is false.\n \n",
	"tags": [],
	"title": "Life is Short",
	"uid": "https://news.ycombinator.com/item?id=10917446"
}]```

Clone this wiki locally