Skip to content

Instantly share code, notes, and snippets.

@parkan
Last active January 25, 2016 18:05
Show Gist options
  • Select an option

  • Save parkan/5f15e4b200fe62e17dcd to your computer and use it in GitHub Desktop.

Select an option

Save parkan/5f15e4b200fe62e17dcd to your computer and use it in GitHub Desktop.
Mediachain Resolver
# request fingerprint lookup from the API
% curl -X POST -H 'Content-Type: application/json' \
-d '{"image_url": "http://www.susanmeiselas.com/images/uploads/MolotovMan-Booklet_520p_70_1.jpg"}' \
https://mediachain-resolver.herokuapp.com/search
{
"matches": [
{
"confidence": 1.0,
"instance_id": "6580df51ed0d44b3a5519c1fc4e69e378df6ffde",
"metadata_id": "QmRBHQVmjKTv6ust1SVjJ4WLQb2p7PJaA1bEespBjb8SwY"
},
{
"confidence": 0.429,
"instance_id": "1fc619f6183d5265b66c6a3550a827ddae134424",
"metadata_id": "QmRBHQVmjKTv6ust1SVjJ4WLQb2p7PJaA1bEespBjb8SwY"
},
...
]
}
# retrieve metadata block (IPFS daemon must be running)
% ipfs cat QmRBHQVmjKTv6ust1SVjJ4WLQb2p7PJaA1bEespBjb8SwY
{
"thumbnailUrl": {
"mlink": "QmXNDXmqfd9p5XXm6EBm6D2i1FbsaBQyBNEieZ2Czhxi77"
},
"@context": "http://schema.org",
"author": "Susan Meiselas",
"@type": "Photograph",
"image_id": "c2ba20ae-8ccc-11e5-b627-83bff0768b7d"
}
# retrieve thumbnail image based on metadata
% ipfs get QmXNDXmqfd9p5XXm6EBm6D2i1FbsaBQyBNEieZ2Czhxi77
Saving file(s) to QmXNDXmqfd9p5XXm6EBm6D2i1FbsaBQyBNEieZ2Czhxi77
36.50 KB 0
# you can also use the IPFS-to-HTTP gateway:
% curl http://gateway.ipfs.io/ipfs/QmRBHQVmjKTv6ust1SVjJ4WLQb2p7PJaA1bEespBjb8SwY
{
"thumbnailUrl": {
"mlink": "QmXNDXmqfd9p5XXm6EBm6D2i1FbsaBQyBNEieZ2Czhxi77"
},
...
}
# or use our helper script:
% ./mchain-resolve.sh http://www.susanmeiselas.com/images/uploads/MolotovMan-Booklet_520p_70_1.jpg
Metadata IPFS locator: QmRBHQVmjKTv6ust1SVjJ4WLQb2p7PJaA1bEespBjb8SwY
Resolving metadata using local ipfs installation...
{
"thumbnailUrl": {
"mlink": "QmXNDXmqfd9p5XXm6EBm6D2i1FbsaBQyBNEieZ2Czhxi77"
}, ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment