Skip to content

Instantly share code, notes, and snippets.

@waynepan
waynepan / youtubedownload.py
Last active December 27, 2018 04:45
Download YouTube Playlist
# YouTube often removes videos without notice
# Download your playlists using this simple script (avoids downloading duplicates)
# 1. have python3 (brew install python or brew upgrade python)
# 2. get pytube (https://github.com/nficano/pytube)
# 3. (probably) follow instructions here if you run into regex issues with akamai https://github.com/nficano/pytube/pull/313
# 3a. find the location of pytube using 'pip3 show pytube'
from pytube import Playlist
from pytube import YouTube
from pytube.helpers import safe_filename
@waynepan
waynepan / gist:5218264
Created March 22, 2013 01:27
Twitter connect close issue patch
# monkey patch to correct Twitter gem experiencing EOF errors
# thread here: https://dev.twitter.com/discussions/15989#comment-35662
# add any where to your code before using the Twitter gem
module Twitter
class Client
def connection
@connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware)) do |f|
f.headers = { "Connection" => "" }
end
end