Skip to content

Instantly share code, notes, and snippets.

@tmhpfnr
Last active February 9, 2016 18:06
Show Gist options
  • Save tmhpfnr/6a252aa68b9f57ed2290 to your computer and use it in GitHub Desktop.
Save tmhpfnr/6a252aa68b9f57ed2290 to your computer and use it in GitHub Desktop.

Setup

  1. Install youtube downloader brew install youtube-dl

  2. Install avconv / libav-tools brew install libav

  3. Install Tor browser

  4. Install proxychains next generation brew install proxychains-ng

  5. [Optional] configure local socks port vi /usr/local/Cellar/proxychains-ng/4.10/etc/proxychains.conf to e.g. 9150

  6. [Optional] Add your alias alias dl-bestaudio="proxychains4 youtube-dl -f bestaudio"

Tips

Tired of m4a? avconv -i input.m4a ouptut.mp3

Want to get a whole playlist from a musicplatform?

Install scrapy pip install Scrapy and create a new project scrapy startproject musicplatform add a new spider musicplatform.py with code

# -*- coding: utf-8 -*-
import scrapy

class MusicplatformSpider(scrapy.Spider):
    name = "musicplatform"

    def __init__(self, url=None, *args, **kwargs):
    	super(MusicplatformSpider, self).__init__(*args, **kwargs)
    	self.start_urls = [url]

    def parse(self, response):
        for sel in response.xpath('//div[contains(@class,"playlist-videos-container")]/*/li'):
        	itemId = sel.xpath('@data-video-id').extract()
        	print 'dl-bestaudio https://musicplatform.com/' + ''.join(itemId)
    	print '' # empty line

than run scrapy crawl musicplatform -a url="https://msuicplatform.com/url/to/playlist"

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