Git Product home page Git Product logo

Comments (9)

ueg1990 avatar ueg1990 commented on August 22, 2024

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.

karan avatar karan commented on August 22, 2024

You for it @ueg1990!

from hackernewsapi.

ueg1990 avatar ueg1990 commented on August 22, 2024

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.

karan avatar karan commented on August 22, 2024

The code makes sense and tests are passing. Good job! :)

from hackernewsapi.

ueg1990 avatar ueg1990 commented on August 22, 2024

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.

karan avatar karan commented on August 22, 2024

@ueg1990 I think it's better to have it for all to keep the API consistent.

from hackernewsapi.

ueg1990 avatar ueg1990 commented on August 22, 2024

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.

karan avatar karan commented on August 22, 2024

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.

ueg1990 avatar ueg1990 commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.