Skip to content

Instantly share code, notes, and snippets.

@davoclavo
Last active December 9, 2016 21:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davoclavo/1567b3da0f6aa19019c0deb574fa783e to your computer and use it in GitHub Desktop.
Save davoclavo/1567b3da0f6aa19019c0deb574fa783e to your computer and use it in GitHub Desktop.
Python script to download your Vine timeline and likes
import os
import vinepy
import time
import requests
vine = vinepy.API(username='your@email.com', password='your_password')
main_dir = os.path.expanduser("~/Desktop/vines/")
def save_vines(vines, subfolder):
sub_dir = os.path.join(main_dir, subfolder)
if not os.path.isdir(sub_dir):
os.makedirs(sub_dir)
for vine in vines:
print(vine.description + " by " + vine.username)
print(vine.videoUrl)
filename = os.path.join(sub_dir, str(vine.id) + '.mp4')
if not os.path.exists(filename):
video_response = requests.get(vine.videoUrl)
with open(filename, 'w') as f:
f.write(video_response.content)
user = vine.user
page = 0
vines = user.timeline(size=100, page=page)
while vines:
save_vines(vines, 'timeline')
time.sleep(1)
page +=1
vines = user.timeline(size=100, page=page)
page = 0
vines = user.likes(size=100, page=page)
while vines:
save_vines(vines, 'likes')
time.sleep(1)
page +=1
vines = user.likes(size=100, page=page)
@davoclavo
Copy link
Author

davoclavo commented Dec 6, 2016

Make sure you have python and pip installed, then install the vine python API client:

git clone https://github.com/davoclavo/vinepy.git
cd vinepy
pip install -r dev-requirements.txt
python setup.py install

@vic
Copy link

vic commented Dec 9, 2016

Finally, the killer app for your API client 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment