DEV Community

DEV Social Badge - Going Open-source!

Benjamin Price on February 25, 2020

I just open-sourced the codebase for the DEV Social Badge that I've been working on. Check it out on GitHub! DEV Social Badge is an unofficial soc...
Collapse
 
supunkavinda profile image
Supun Kavinda

Hey, This is super cool! One suggestion: Is there a way to pull reactions as it is (heart, unicorn, and bookmarks seperately) and display them with the icons? It would be more cool. 😊

Collapse
 
benjaminjprice profile image
Benjamin Price

Sadly, no. The API only offers a sum of all positive reactions - not a breakdown of each.

Collapse
 
supunkavinda profile image
Supun Kavinda

Ah, got it.

Btw, simply scrape the URL of the post and get the values from HTML.

Collapse
 
supunkavinda profile image
Supun Kavinda

Ah wait, you have to render the HTML - because it's built on react.

Thread Thread
 
benjaminjprice profile image
Benjamin Price

Yes, as this is a client side script I don’t want to scrape anything and rather just rely on the APIs.

I could make a request for the functionality in the API but there’s no guarantee it will be added.

Collapse
 
ben profile image
Ben Halpern

This is really cool!

Collapse
 
benjaminjprice profile image
Benjamin Price

Thanks, Ben. Glad you like it.

Collapse
 
waylonwalker profile image
Waylon Walker

Is there any possibility to get comment count or comments? I looked at one graph and it didn't seem to have a way. I didn't dig any deeper.

Collapse
 
benjaminjprice profile image
Benjamin Price

In regards to comments, I can pull the comment count and the last comment datetime stamp but not the actual comments. How would you envision those being used? Reaction and Comment counts side by side? or a toggle between the two? Or perhaps something else...?

Collapse
 
rhymes profile image
rhymes • Edited

You can pull the comments from dev.to/api/comments

For example, all comments from this article are dev.to/api/comments?a_id=268819

This comment I just wrote it'll be: dev.to/api/comments/m10o

The documentation is a "bit" behind :D

Thread Thread
 
benjaminjprice profile image
Benjamin Price

Thank you. I wasn't aware. Perhaps I will create a separate library for pulling all of the comments.

Collapse
 
waylonwalker profile image
Waylon Walker

Not sure, I would really like to embed comments on my site.

As for omment count does it make sense to separate them with a pipe?

reaction | comments

Thread Thread
 
benjaminjprice profile image
Benjamin Price

I'll play with it and see what I can come up with.

Ultimately, I'd like to get a few different formatting options in place that can be selected based on how the user wants it shown on their website.

Collapse
 
saurabhdaware profile image
Saurabh Daware 🌻

This is soo cool!! 🌻

Collapse
 
rhymes profile image
rhymes

Nice, Benjamin!