Last active
December 9, 2016 21:33
Python script to download your Vine timeline and likes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
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
Make sure you have python and pip installed, then install the vine python API client: