Skip to content

Commit

Permalink
Feat : Lbrymeta dump code
Browse files Browse the repository at this point in the history
  • Loading branch information
Eniamza committed Jan 14, 2021
1 parent 553d0c0 commit 9129df5
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
27 changes: 27 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const fs = require('fs');
const axios = require('axios');
const prompt = require('prompt-sync')();

let metadata;
let lbryData;
let channelClaim = prompt(`Enter Channel Claimid:`);
let url = `https://chainquery.lbry.com/api/sql?query=SELECT%20*%20FROM%20claim%20WHERE%20publisher_id%20=%20%27${channelClaim}%27%20AND%20bid_state%20%3C%3E%20%27Spent%27`;

console.log(url);
axios.get(url)
.then (response =>{
metadata= response.data;
metadata=JSON.stringify(metadata, null, 1);
lbryData= JSON.parse(metadata);

console.log(`Full Dump Mode selected`);
console.log(`API is Working and successfully fetched. Writing Data to File!`);
fs.writeFileSync('meta.json', metadata);


})
.catch(error => {
console.log(error);
});


42 changes: 42 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "lbrymeta",
"version": "0.1.0",
"description": "A script that dumps channel meta in CSV",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"lbry",
"lbrynet",
"channel",
"dump",
"csv"
],
"author": "Eniamza",
"license": "MIT",
"dependencies": {
"axios": "^0.21.1",
"prompt-sync": "^4.2.0"
}
}

0 comments on commit 9129df5

Please sign in to comment.