Created
September 3, 2017 19:16
-
-
Save kirkins/7d9dcafb6d3d725c9a8bf3e359f79334 to your computer and use it in GitHub Desktop.
A script that downloads banned youtube videos shared by a twitter user
This file contains 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
#!/usr/bin/env python | |
# | |
# A python that fetches the 200 latest tweets from a user | |
# then downloads any youtube video linked to. | |
# | |
# User can be changed with the variable below | |
user="YoutubeSandbox" | |
import re | |
import twitter | |
import youtube_dl | |
api = twitter.Api(consumer_key='', | |
consumer_secret='', | |
access_token_key='', | |
access_token_secret='') | |
statuses = api.GetUserTimeline(screen_name=user, count=200) | |
for s in statuses: | |
ydl_opts = {'outtmpl':'./video/%(title)s-%(id)s.%(ext)s'} | |
with youtube_dl.YoutubeDL(ydl_opts) as ydl: | |
ydl.download([re.search("(?P<url>https?://[^\s]+)", s.text).group("url")]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Banned-from-youtube-downloader
A script that downloads banned youtube videos shared by a twitter user
Setup
Get twitter app credentials at apps.twitter.com, fill them out in
get.py
:Install requirments with pip:
Optional, change source user for downloads:
Run Script
After setup run with: