Skip to content

Commit

Permalink
add any user download
Browse files Browse the repository at this point in the history
You can now download Vine from any user
  • Loading branch information
phiphou committed Nov 4, 2016
1 parent 6c53907 commit 6ecd008
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vine-backup",
"version": "1.1.0",
"version": "1.2.0",
"description": "A very basic tool for downloading your Vines before the service shut down.",
"author": "Phiphou",
"license": "MIT",
Expand Down
36 changes: 26 additions & 10 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ if (!argv.email) {
if(error){
console.log('Unable to connect, please check your credentials.')
} else {
if(argv.likes)
getLikes(client)
else
getList(client)
}
if(argv.user) {
getUserVines(client, argv.user)
} else {
if(argv.likes)
getLikes(client)
else
getList(client, client.userId, 'Me')
}
}
})
}

Expand All @@ -29,16 +33,28 @@ function getLikes(client, page = 0) {
if (user.nextPage !== null)
getLikes(client, user.nextPage)
else
getList(client)
getList(client, client.userId, 'Me')
})
}

function getUserVines(client,twitterScreenName) {
client.searchUsers(twitterScreenName, (error, user) => {
if(!error){
if(user.records.count == 0)
console.log('user not found')
else {
getList(client, user.records[0].userId, twitterScreenName)
}
}
})
}

function getList(client, page = 0) {
client.user(client.userId, {page: page}, (error, user) => {
function getList(client, userId, userName, page = 0) {
client.user(userId, {page: page}, (error, user) => {
for (let r of user.records)
videos.push({type: 'me', data: r})
videos.push({type: userName, data: r})
if (user.nextPage !== null) {
getList(client, user.nextPage)
getList(client, userId, userName, user.nextPage)
} else {
console.log(videos.length + ' Vines to download.')
dl()
Expand Down

0 comments on commit 6ecd008

Please sign in to comment.