Open bishopmatthew opened 11 years ago
Will be trying my hand at patching this up when I find the time; will comment here if I stop actively dev'ing on it.
The first you'd want to do is look at:
That's where the HTML containing the header story is sent to be parsed. You'll want to look at the raw HTML from both a poll and non-poll thread, and see if you can spot any identifying features (a div that only appears on polls, for example). Then you can split that call up into two separate methods like parseStory() and parseStoryWithPolls(). The easiest thing to do is just fix whatever's throwing the exception, and ignore all the poll options. Further extensions might include adding a UI for viewing and voting in polls -- if you try to add that, look at:
Like I said, I'm happy to help if you try this out and run into any problems.
Seems like polls have td.comment
elements inside of the same table body as title
and subtext
elements. Considering a few solutions to detect this.
Yeah, if you look at the rest of the parsing code, there's a lot of kinda hacky stuff going on because the layout is table-based and doesn't have semantic classes. One idea -- on the top-level tbody that contains the story and poll, select <img>
elements and if there's more than one or two, you must be on a poll.
Hey, just wanted to chime in and mention that this is an issue that has bothered me for a while now. I might take a stab at it myself but don't have too much free time. I'll report back if I do manage to hack anything together. In the meantime, thanks for developing this app @bishopmatthew ! :-)
Its bothered us too; we seem to have programmed ourselves into a corner here, however. V3 has much more modular calls for getting parsable data, and will certainly have this feature. Sorry for the lack of updates on it! I may take a stab at it tomorrow on my flight, but who knows
For example, the AMA poll thread. At this time, I don't want to write the extra code to support displaying the poll options and actually allow voting (someone else is certainly free to do so). But it should at least display the title, selfText, and comments correctly.