Examples for using this repo to download LBRY content? #83
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
dependencies
Epic
good first issue
hacktoberfest
help wanted
icebox
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
priority: blocker
priority: high
priority: low
priority: medium
resilience
Tom's Wishlist
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbry.go#83
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I would like to write a client program that, given a LBRY URI (e.g.
lbry://@irmf#a/irmf-logo-model-1.irmf#4
),the client downloads the data (provided that either the user has already paid for the content or the content is free).
Eventually, it would be nice to allow the user to optionally send credits if the content is gated and they have not already purchased it. But for starting out, I would just like to download the content that is either free or previously-paid-for.
I'm not finding any examples, and searching through the subdirectories, it is not obvious to me how to get started.
If I were to take a random stab-in-the-dark, for example, I might try doing the following:
lbrycrd.New(lbrycrdURL, chainParams)
(What shouldlbrycrdURL
andchainParams
be?)but then I get stuck, as none of the methods appear to be what I want.
Alternatively, maybe I need to go this route:
blobex.NewBlobExchangeClient(cc)
(How should I getcc
correctly?)blobex.Download(ctx)
(How do I specify the URI for the content?)Can you please provide some guidance on the steps that need to be taken?
Thank you!
@gmlewis thanks for your interest. Our Go codebase is a bit scattered right now because we've been focused on our primary Python implementation. We have this repo, and https://github.com/lbryio/reflector.go. What you're looking for is spread across both.
Here are some pointers to get you started on downloading something that's free. I'll omit the payment details for now.
dht.Get(sdHash)
to get a list of peers for that hash.I hope this is enough to get you started. I'm planning to unify our Go code into a single repo in the near future and provide clearer examples of the steps. If you want more nitty-gritty details, check out the LBRY spec.
What's your LBRY address? I'll send you some LBC to get you started.
Awesome! Thank you, @lyoshenka ... this is extremely helpful!
My LBRY address is: bQWkPubxVt9JdPuR2iZPcJrDX3BJcHncwG
Welcome @gmlewis! Would love to know what you're working on, when you're ready :)
Thank you, @kauffj!
My latest obsession is: http://irmf.io and specifically, I would like to deliver IRMF models via the LBRY protocol from within two of my programs so that the digital files are treated as first-class citizens and gated appropriately based on purchase history:
Both programs are written in Go, and the first one compiles to WebAssembly, which has been lots of fun to write. 😄
Oh, and on LBRY, I now have two channels: @irmf and @gmlewis.
The first one has a free IRMF test model, but I haven't published anything from the second channel yet. 😄
Since irmf-editor is run in the web browser, starting up a dht node server is a non-starter, but if I can use a public wallet server as a launch-point without running a dht node, and still download the content, then I think this just might work!
@gmlewis how did it go?
@lyoshenka - I actually hit a roadblock that I've been trying to solve.
As far as I can tell,
github.com/spf13/viper
is not WASM-friendly, and it is unfortunately a dependency ofgithub.com/lbryio/reflector.go
:The error I'm getting is:
Which appears to be this issue: https://github.com/desmos-labs/desmos/issues/2
So it looks like I'm currently stuck. 😞
Hey @gmlewis any progress on spf13/viper issue? I am facing the same.
Did you managed somehow to bypass it?
No, @dpanic , unfortunately I'm still stuck. Please report back here if you find a solution or workaround! Thanks.
@gmlewis you could fork the repo and remove the dependency. you may have to change the way we load configs in 1 or 2 places, but feel free to hack around any roadblocks.
if that works for you, I can look into removing it from the main repo as part of a refactor we're planning. let me know how it goes
I made some good progress by forking:
and then removing the dependency upon github.com/spf13/viper by modifying a single file...
but then was surprised by an unexpected error message:
I must have some version mismatches now that will take some more investigation.
try putting this in your go.mod, above the require line
@tiger5226 may know more about this error too
@lyoshenka - Sweet! I now have a successful build. Thank you!
I have to work now, but after work I'll see if I can download the (free) content from the lbry URI from my Go-based WebAssembly client.
The next step will be to figure out how to download paid content.
Have you guys implemented any kind of OpenID/OAuth2 "Log in with lbry.tv" or "Log in with Odysee.com" so that our client programs never have to deal with usernames and passwords even for paid content?
I just hit the next snag:
Apparently, Go in WebAssembly doesn't support the tcp procotol:
https://stackoverflow.com/questions/55880920/dial-tcp-protocol-not-available-go-webassembly-test
This is true. Anything to be used in a browser is limited by browser APIs. We have the https://github.com/lbryio/lbrytv-player repository. This exposes a web server to download lbry content from a webpage which would be WASM compatible for you since its over http.
Since this is a native application that leverage WASM, it might be interesting to try an alternative route. I am not sure of your web development skills, but one thing I have done in the past with Go is packaging an app into a single binary that contains 2 pieces. A website, so that you can build a UI with a web language. It launches the webpage on startup. Then as part of the binary a web server/app is launched which is what the web page opens to. So that contains the APIs for the webpage to use locally.
It leverages some great Go Libs to make it all come together for a fast POC. Namely packr2. The interesting part is that if you had something similar you could use all the native go codebases without change and be able to handle your frontend and backend in the same app, while also leveraging a more native web experience like angular.
Just an idea to investigate.