Last active
          April 9, 2019 03:27 
        
      - 
      
 - 
        
Save DataKinds/8365053c42cedb812a2fbb998535d9a7 to your computer and use it in GitHub Desktop.  
    download all top fonts off dafont
  
        
  
    
      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
    
  
  
    
  | require "nokogiri" | |
| require "open-uri" | |
| `rm fontUrls` | |
| fontUrlFile = File.open("fontUrls", "a") | |
| (1..50).each do |pageIndex| | |
| page = Nokogiri::HTML(open("http://www.dafont.com/top.php?page=#{pageIndex}")) | |
| page.css(".dlbox .dl").each do |downloadButton| | |
| fontUrlFile.puts "https:#{downloadButton['href']}" | |
| puts downloadButton["href"] | |
| end | |
| end | |
| fontUrlFile.close | |
| File.read("fontUrls").each_line do |url| | |
| puts url | |
| Thread.fork do | |
| `curl '#{url.chomp}' -o '#{url.scan(/f=(.+)$/)[0][0]}.zip'` | |
| end | |
| end | 
  
    
      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
    
  
  
    
  | require "fileutils" | |
| `mkdir ohLordTheFonts` | |
| Dir.glob("*.zip").each do |fileName| | |
| `unzip -n #{fileName} -d ohLordTheFonts/` | |
| end | |
| `#{DATA.read}` | |
| __END__ | |
| cd ohLordTheFonts && find . -not -name "*.otf" -not -name "*.ttf" -delete; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment