here’s code i’ve written so far for dealing with this particular method, still in-progress - i’ll be putting it up on github eventually but maybe the code will help. i am using it over on my site - Kitty4D on the B-Chain - DeSo Post Vault - so, it does work.
then i have a little helper method that just abstracts it out a little. originally i had my ‘get-posts-all’ logic in the code that requires this module, but i thought it might be more useful to include that in here. though i’m not 100% sure that a while loop is totally cool with these promises - but it works, and i did look things up as i was writing it.
case'get-posts': /* for Posts, pass: pk: reader's public key, postHashHex: for paging, send last received post hash, orderBy: newest|oldest|last_comment, postContent: only return posts whose (body only?) matches the text, numToFetch: non-zero, fetchSubComments: return 1 level deep of comments? haven't tested yet, getPostsForFollowFeed: follow feed for reader's pk, getPostsForGlobalWhitelist: global posts, i guess this is node-agnostic?, getPostsByDESO: kinda basically the hot feed i guess, mediaRequired: false, or true but would be nice to specify image and/or video postsByDESOMinutesLookback: must be <= 60, getPostsByDESO = true - dunno why it doesn't work for all, addGlobalFeedBool: posts will contain a bool (but i kinda thought they already had an IsGlobal..?) */ try{ res =awaitthis.getPosts({pk: params.readerPk ? params.readerPk :undefined, postHashHex: params.postHashHex ? params.postHashHex :undefined, orderBy: params.orderBy ? params.orderBy :undefined, postContent: params.postContent ? params.postContent :undefined, numToFetch: params.numToFetch ? params.numToFetch :10, mediaRequired: params.mediaRequired ? params.mediaRequired :false}); res = res.PostsFound; }catch(error){ res =[]; } break;
case'get-posts-all': /* for Posts, pass: pk: reader's public key, postHashHex: for paging, send last received post hash, orderBy: newest|oldest|last_comment, postContent: only return posts whose (body only?) matches the text, numToFetch: non-zero, fetchSubComments: return 1 level deep of comments? haven't tested yet, getPostsForFollowFeed: follow feed for reader's pk, getPostsForGlobalWhitelist: global posts, i guess this is node-agnostic?, getPostsByDESO: kinda basically the hot feed i guess, mediaRequired: false, or true but would be nice to specify image and/or video postsByDESOMinutesLookback: must be <= 60, getPostsByDESO = true - dunno why it doesn't work for all, addGlobalFeedBool: posts will contain a bool (but i kinda thought they already had an IsGlobal..?) */ try{
let batch =null; let results =[];
let lastPostHash = params.postHashHex ? params.postHashHex :undefined;
it would be nice if it had info about the response, but even having info about the parameters is brand new and a welcome change. these links are provided on that page, but i’ll include them here as well. these links go to the DeSo Githubs:
Contribute to bitclout/explorer development by creating an account on GitHub.
2
brootle22-Apr-21 04:02 AM
I think they are building their own apps on top of Bitclout API, so this is not in their interest to make life of other devs easy.
brootle22-Apr-21 04:20 AM
it makes me angry as hell
or maybe their level is so low that they simply have no idea what they are doing and how to make it right
cfky
Has anyone found a way to get the bitcoin deposit address linked to a bitclout wallet?
cdj22-Apr-21 04:55 PM
I noticed that it is appended to the mailto link on the help, mine looks like
"mailto:[email protected]?body=The below information helps support address your case.
My public key: BC1YLimromSjtiJo8Y7C9xwL9MFf8z5BdEidjWTC4WAiUZct2VrHbr8
My BTC Address: 1P3V4joGWzbFPmNEDSZgQw6KGrrT2vSZnf"
if that's what you meant
so I'm looking for timestamps, they're returned on the get-posts API, but I don't see them on blockchain explorer EDIT found PrivateMessageTxindexMetadata, maybe its a different place for each action(edited)
btw I got blockchain explorer running locally using mitmproxy but I'm annoyed with how much code it took, if anyone knows how to set headers on mitmproxy on the command line and not in a python script lmk
1
leonardofibonacci22-Apr-21 01:35 AM
Is there a way to use get-posts-stateless to get only posts of one publickey? I am using it and it appears to just get a general list of random posts
leonardofibonacci
@salil have you figured out how to grab posts for one particular user?
salil27-Apr-21 12:58 AM
The cURL should be:
curl 'https://api.bitclout.com/get-posts-for-public-key' \
-H 'Connection: keep-alive' \
-H 'Accept: application/json, text/plain, /' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Ontel Mac OS X 11_2_3) AppleWebKit/537/36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36' \
-H 'Content-Type: application/json' \
-H 'Accept-Language: en, zh-TW;q=0.8,en-US;q=0.7' \
--data-raw '{"PublicKeyBase58Check":"BC1YLgQkRFM1P3qvW5HQ47cTCikyfB464o4oEbqRkcqJohVs3jfUPib"}' \
--compressed \
--insecure
But it is not pulling the posts. Pretty sure there is some flag that needs to be passed in the body that we don't know off yet. Method seems to be correct
1
OG DeSo - Technical Talk > nodes
petern10-Jun-21 05:55 PM
I was also wondering, when you call e.g. /api/v0/get-posts-stateless you get PostEntryResponse struct as a response. It has a LikeCount field, but doesn't contain details about who liked the post. Is there any way to get that information?
petern
I was also wondering, when you call e.g. /api/v0/get-posts-stateless you get PostEntryResponse struct as a response. It has a LikeCount field, but doesn't contain details about who liked the post. Is there any way to get that information?
Crypto Fren10-Jun-21 05:58 PM
haven't been there, i guess you can make some modifications to the backend ?
when i needed i joined a go discord channel lol the guys helped me a lot
Crypto Fren
haven't been there, i guess you can make some modifications to the backend ?
petern10-Jun-21 06:00 PM
I noticed that in UtxoView you have a LikeKeyToLikeEntry field, which is exactly what I want, but it's currently only used to count the number of likes. I was trying to code it so that the PostEntryResponse also returns the LikeEntries. @maebeam Do you think it's possible to do, or should I give up and accept we can only get like count lol?
JustifydWarrior10-Jun-21 06:00 PM
we can do it from the v1 api data with heavy post processing
i get 4+ mb of json data back from the trasancactions api(edited)
but that's just a hack/workaround. not a long term solution
petern10-Jun-21 06:02 PM
if only those ConnectTransaction errors wouldn't return instead...(edited)
JustifydWarrior10-Jun-21 06:04 PM
my mempool tab now pops this up but seems to be working when i close it
but the posts tabs work, every other tab works. that endpoint returns stuff
just when you refresh on the admin tabs(edited)
i cannot duplicate the 502 on that endpoint
petern
I noticed that in UtxoView you have a LikeKeyToLikeEntry field, which is exactly what I want, but it's currently only used to count the number of likes. I was trying to code it so that the PostEntryResponse also returns the LikeEntries. @maebeam Do you think it's possible to do, or should I give up and accept we can only get like count lol?
Crypto Fren10-Jun-21 06:19 PM
it is possible, backend is nothing from the other world
and golang is not so hard as it seems
kind of a mixture between python & c
petern
I noticed that in UtxoView you have a LikeKeyToLikeEntry field, which is exactly what I want, but it's currently only used to count the number of likes. I was trying to code it so that the PostEntryResponse also returns the LikeEntries. @maebeam Do you think it's possible to do, or should I give up and accept we can only get like count lol?
Thanks, also found the backend branch. This is how I feel about you and Rph now:
curl --location --request GET https://complimentr.com/api(edited)
DeSo Foundation Tech - DEVELOPERS > dev-support
justNick26-Jan-22 03:34 PM
Is anyone using the "MediaRequired" flag in the get-posts-stateless call? I am getting results that have no image or video URL. I do notice that some of the results have null in the value, while others have "". Is the backend only checking for nulls?
justNick02-Feb-22 10:35 AM
since MediaRequired flag does not work on get-posts-stateless, I need to pull 5000 posts to get 100 videos right now. I really hope this gets resolved. Issue raised on github.
justNick
since MediaRequired flag does not work on get-posts-stateless, I need to pull 5000 posts to get 100 videos right now. I really hope this gets resolved. Issue raised on github.
cfky02-Feb-22 11:16 AM
What is your use case? Trying to see if I can make it work on my wrapper
justNick02-Feb-22 12:39 PM
I'm only interested posts that have a valid VideoURL
also.. who's idea was it to not have follower count in profile? Am I missing something?
justNick
also.. who's idea was it to not have follower count in profile? Am I missing something?
cfky02-Feb-22 12:41 PM
yeah it's a separate endpoint... I actually just added it to the graphql wrapper hahaha
1
justNick02-Feb-22 02:36 PM
How do I get the sub comments to populate in the get-single-post call?
justNick
since MediaRequired flag does not work on get-posts-stateless, I need to pull 5000 posts to get 100 videos right now. I really hope this gets resolved. Issue raised on github.
cfky02-Feb-22 03:06 PM
This works btw afaik
Media is also in PostExtraData
justNick02-Feb-22 03:19 PM
PostExtraData?
i see tons with nothing in PostExtraData and no image or video url populated
justNick02-Feb-22 03:31 PM
is it including a post if it has a re-post with media?
justNick02-Feb-22 03:41 PM
even then I see posts with media and no reposts with empty PostExtraData. no media in sight
justNick
even then I see posts with media and no reposts with empty PostExtraData. no media in sight
cfky02-Feb-22 03:53 PM
Can you give me an example with a request and a post that doesn't match please?
justNick02-Feb-22 04:12 PM
check postHashHex a7ae35e78631fd4ce10941879bfe547931d4a633891ca2d800e0d03ee5d93faa. it is returned in the response
justNick02-Feb-22 04:20 PM
looks to me like the flag is ignored in post.go when not using followFeed or globalFeed option
Yes, I have seen something like this. I have a code somewhere to deal with all of the combinations. (there is more if I remember correctly )
Kuririn
Yes, I have seen something like this. I have a code somewhere to deal with all of the combinations. (there is more if I remember correctly )
piratekev03-Feb-22 05:37 PM
I can refactor to handle this scenario but was more curious how this occurred. I haven't been able to recreated it from any node, only by directly submitting a transaction with the imageUrl set as ""
piratekev
I can refactor to handle this scenario but was more curious how this occurred. I haven't been able to recreated it from any node, only by directly submitting a transaction with the imageUrl set as ""
kitty4D03-Feb-22 08:29 PM
if it's possible like that, then it's possible and doesn't really matter what node allows it. eventually it sounds like things will be tagged with originatingNode but even then, you never really know what app/site might be interacting with its backend API unless it's closed off
piratekev
I can refactor to handle this scenario but was more curious how this occurred. I haven't been able to recreated it from any node, only by directly submitting a transaction with the imageUrl set as ""
ADITYA03-Feb-22 11:15 PM
Upload image > then remove it > post it
kitty4D17-Feb-22 10:14 AM
is there a fixed max number of posts that can get returned by get-posts-stateless? or maybe a max amount of days back it can go? i don't mean per request. i got about 1135 posts and then the next request brought back an empty array.
kitty4D
is there a fixed max number of posts that can get returned by get-posts-stateless? or maybe a max amount of days back it can go? i don't mean per request. i got about 1135 posts and then the next request brought back an empty array.
Kuririn17-Feb-22 10:32 AM
you can paginate by PostHashHex or StartTstampSecs I believe, there is also NumToFetch param
I want a reliable way to determine the non-hidden reposts & quote-reposts. Can someone guide me?
mubashariqbal24-Dec-21 11:12 PM
I believe in the response there is a "IsHidden" field. This is per node, so something might be hidden on DiamondApp, but not hidden on other nodes, and vice versa.
nandubatchu24-Dec-21 11:34 PM
On DiamondApp UI the repost is hidden, though in the API - it is marked as IsHidden: false(edited)