<jupyter_start><jupyter_text>GotDrawnUpdating GetsDrawnDotCom with title feature.Taking getsdrawndotcom code and adding in features such as comments.Getting rid of folder structure.<jupyter_code>import os
import requests

import re
import json
import arrow

import praw

import dominate

from dominate.tags import * 

import shutil

from time import gmtime, strftime

gotdrndir = ('/home/wcmckee/gotdrawn/imgs')
r = praw.Reddit(user_agent='getsdrawndotcom')
fulcom = []
fuldic = dict()
getrn = r.get_subreddit('redditgetsdrawn')
rnew = getrn.get_new()
for rnc in rnew:
    fulcom.append(rnc)
artes = arrow.utcnow()
yrpath = artes.strftime('%Y')
mntpath = artes.strftime('%m')
dapth = artes.strftime('%d')
if os.path.isdir(gotdrndir) == True:
    print 'its true'
else:
    print 'its false'
    os.mkdir(gotdrndir)
imgszpath = (gotdrndir)
yrzpat = (imgszpath + '/' + yrpath)
mntzpat = (yrzpat + '/' + mntpath)
datzpat = (mntzpat + '/' + dapth)
imgszpath
dayform = ('imgs/' + yrpath + '/' + mntpath + '/' + dapth)
dayform
if os.path.isdir(yrzpat) == True:
    print 'its true'
else:
    print 'its false'
    os.mkdir(yrzpat)
if os.path.isdir(mntzpat) == True:
    print 'its true'
else:
    print 'its false'
    os.mkdir(mntzpat)
if os.path.isdir(datzpat) == True:
    print 'its true'
else:
    print 'its false'
    os.mkdir(datzpat)
datzpat
mntzpat
datzpat
if os.path.isdir(yrpath) == True:
    print 'its true'
else:
    print 'its false'
    os.mkdir(yrpath)
#mthzpath = (yrzpat + '/' + 
#if os.path(
print artes.date()
print artes.time()
dati = artes.datetime
#Random logo from logo folder.
#5 to choose from. import random, random choice out of a list
import random
imglis = ['img1', 'img2', 'img3', 'img4', 'img0']
random.choice(imglis)
os.listdir('/home/wcmckee/gotdrawn/logo')
import PIL
imed = PIL
imed.PILLOW_VERSION
#import pillow
os.chdir('/home/wcmckee/gotdrawn/')
imlocdir = (dayform + '/' + str(flc.author) + '-reference.png') 
imlocdir
doc = dominate.document(title='GetsDrawn')

with doc.head:
    link(rel='stylesheet', href='style.css')
    script(type ='text/javascript', src='script.js')
    #str(str2)
    
    with div():
        attr(cls='header')
        h1('GetsDrawn')
        p(img('imgs/getsdrawn-bw.png', src='imgs/getsdrawn-bw.png'))
        #p(img('imgs/15/01/02/ReptileLover82-reference.png', src= 'imgs/15/01/02/ReptileLover82-reference.png'))
        h1('Updated ', str(artes.datetime))
        #p(panz)
        #p(bodycom)
    
    

with doc:
    with div(id='body').add(ol()):
        for flc in fulcom:
            if 'http://i.imgur.com' in flc.url:
                p(h1(flc.title))
                p(img(imlocdir, src= imlocdir))
                #p(img(flc.url, src = flc.url))
                p(str(flc.author))
                #res = requests.get(flc.url, stream=True)
                #with open(str(flc.author) + '-' + str(artes.date()) + '-reference.png', 'wb') as outfil:
                #    shutil.copyfileobj(res.raw, outfil)
                #    del res
                
                
            
        for flcz in flc.comments:
                p(flcz.body)
        
        
        #for rdz in reliz:
            #h1(rdz.title)
            #a(rdz.url)
            #p(img(rdz, src='%s' % rdz))
            #print rdz
            #p(img(rdz, src = rdz))
            #p(rdz)


                
            #print rdz.url
            #if '.jpg' in rdz.url:
            #    img(rdz.urlz)
            #else:
            #    a(rdz.urlz)
            #h1(str(rdz.author))
            
            #li(img(i.lower(), src='%s' % i))

    with div():
        attr(cls='body')
        p('GotDrawn is open source')
        a('https://github.com/getsdrawn/getsdrawndotcom')
        a('https://reddit.com/r/redditgetsdrawn')

#print doc
docre = doc.render()
#s = docre.decode('ascii', 'ignore')
yourstring = docre.encode('ascii', 'ignore').decode('ascii')
indfil = ('/home/wcmckee/gotdrawn/index.html')
mkind = open(indfil, 'w')
mkind.write(yourstring)
mkind.close()
fertz = datzpat + '/' 
fertz
print doc
os.chdir(fertz)
for flc in fulcom:
    if 'http://i.imgur.com' in flc.url:
        print flc.title
        print flc.url
        print flc.author
        res = requests.get(flc.url, stream=True)
        with open(str(flc.author) + '-' + str(artes.date()) + '-reference.png', 'wb') as outfil:
            shutil.copyfileobj(res.raw, outfil)
            del res
            
        for flcz in flc.comments:
            print flcz.body
flcz.author

flcz.body<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1502202643171806, 'fraction_numerical': 0.006167400881057269, 'mean_word_length': 2.393871449925262, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '324386', 'license': 'MIT', 'n_tokens_mistral': 1742, 'n_tokens_neox': 1710, 'n_words': 349, 'path': '.ipynb_checkpoints/gotdrawn-checkpoint.ipynb', 'repo_name': 'GetsDrawn/getsdrawndotcom', 'size': '4540'}