Comments (9)
I can see why this is happening....each sub-comment is treated as a separate comment. so if u print comments[1].body_html u will get the first reply to comments[0].body_html. i will try to fix it unless Karan can fix it before me :)
from hackernewsapi.
You for it @ueg1990!
from hackernewsapi.
hey karan, i thin i fixed the problem. what i did was for each comment that had nested comments, i aded it to the current comment but still treated each comment as separate comments too. that is if comments[0] has comments[1] and comments[2] as nested comments, i concatenate the body and body_html of both comments[1] and comments[2] to comments[0], but comments[1] and comments[2] are still in the comments array. I know the explanation is confusing but i will add a pull request and u can have a look and let me know what you think. :)
from hackernewsapi.
The code makes sense and tests are passing. Good job! :)
from hackernewsapi.
just to confirm, do u want this functionality to only be for comments at level 0?? as in retrieve all the comments only for at level 0?
from hackernewsapi.
@ueg1990 I think it's better to have it for all to keep the API consistent.
from hackernewsapi.
as in u want all comments under level 1 to be concatenated to its body and so on for comments at other levels??
from hackernewsapi.
I'm not sure what you mean, but comments should be in JSON format, with a list of individual comments.
The next level of this, is to make nested dicts. So comments[0]
means the first comment, comments[0][0]
means the first reply of first comment etc. This is where the level
field will be useful.
Also, make sure to update the README as the code evolves to keep it in sync with the features.
from hackernewsapi.
Ok, looks a bit tricky. will let you know if i need some help.
On Wed, Mar 19, 2014 at 4:00 PM, Karan Goel [email protected]:
I'm not sure what you mean, but comments should be in JSON format, with a
list of individual comments.The next level of this, is to make nested dicts. So comments[0] means the
first comment, comments[0][0] means the first reply of first comment etc.
This is where the level field will be useful.Also, make sure to update the README as the code evolves to keep it in
sync with the features.Reply to this email directly or view it on GitHubhttps://github.com//issues/30#issuecomment-38099632
.
USman
from hackernewsapi.
Related Issues (20)
- user data. HOT 16
- get_comments : IndexError: list index out of range HOT 3
- Get any stories comments.
- Why limit = 30? HOT 6
- IndexError: list index out of range (comments) HOT 5
- newest and best options do not work in get_stories
- Make tests work HOT 2
- Respect robots.txt HOT 3
- UnicodeEncodeError in my_test_bot.py
- Get comments for a story is breaking when no comments are there on Hackernews page
- HackerNews HTML has changed, API has stopped working HOT 2
- Is there any way to find stories by title? HOT 4
- Add python 3 support and test it
- Cannot parse result HOT 1
- Fix simple typo: explititly -> explicitly
- Wf
- Beast
- Can't access my accounts
- packages/modules/adbd
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hackernewsapi.