<jupyter_start><jupyter_text>Enter a keyword and searches for digitalnzcontent. Filter out gifs, remixing. put digital nz location image<jupyter_code>keywodsea = input('dnz keyword: ')
from dominate.tags import *
import dominate
opdigke = open('/home/wcmckee/Downloads/digital.txt', 'r')
oprdz = opdigke.read()
opstrip = oprdz.strip('\n')
opdigke.close()
opets = open('/home/wcmckee/github/wcmckee.com/output/minedujobs/index.json', 'r')
oprdz = opets.read()
lenciv = len(json.loads(oprdz))
lenciv
loorgin = list()
for lenves in range(0, lenciv):
    print(json.loads(oprdz)[str(lenves)]['Location'])
    loorgin.append((json.loads(oprdz)[str(lenves)]['Location']))
for looset in set(loorgin):
    print(looset)
    apidig = ('http://api.digitalnz.org/v3/records.json?api_key=' + opstrip + '&and[category]=Images&and[is_commercial_use]=True&text=' + looset)
    reqseapi = requests.get(apidig)
    
    #print(reqapi.text)
    lenresu = len(json.loads(reqseapi.text)['search']['results'])
    print(lenresu)
    
apidig = ('http://api.digitalnz.org/v3/records.json?api_key=' + opstrip + '&and[category]=Images&and[is_commercial_use]=True&text=' + keywodsea)
#Error from this

#for lenves in range(0, lenciv):
#    print(json.loads(oprdz)[str(lenves)]['Location'])
#    print(('http://api.digitalnz.org/v3/records.json?api_key=' + opstrip + '&and[is_commercial_use]=True&text=' + (json.loads(oprdz)[str(lenves)]['Location'])))
    
#    reqapi = requests.get(apidig)
    
    #print(reqapi.text)
#    print(json.loads(reqapi.text)['search']['results'])
reqapi = requests.get(apidig)
json.loads(reqapi.text)['search']['results'][0]['landing_url']
lenres = json.loads(reqapi.text)['search']['results']
rele = len(lenres)
gifstrz = list()
for rea in range(0, rele):
    print(rea)
    print(lenres[rea]['title'])    
    
    for contenpar in (lenres[rea]['content_partner']):
        print(contenpar)
    
    print(lenres[rea]['created_at'])
    
    print(lenres[rea]['rights'])
    
    print(lenres[rea]['source_url'])
    
    print(lenres[rea]['thumbnail_url'])
    gifstrz.append(lenres[rea]['thumbnail_url'])

    
    print(lenres[rea]['category'])
    
    print(lenres[rea]['display_collection'])
glen = len(gifstrz)
glen
for gifim in gifstrz:
    #a(rdz.url)
    response = requests.get(gifim, stream=True)
    for gl in range(0, glen):
        print(gl)
        with open('/home/wcmckee/gify/' + str(gl) + '.gif', 'wb') as out_file:
            shutil.copyfileobj(response.raw, out_file)
            
dignzdoc = dominate.document(title='dignzgif')

with dignzdoc.head:
    link(rel='stylesheet', href='style.css')
    script(type ='text/javascript', src='script.js')
    #str(str2)
    
    with div():
        attr(cls='header')
        h1('dignzgif ' + keywodsea)
        p(img('imgs/logo.svg', src='imgs/logo.svg'))
        #p(img('imgs/15/01/02/ReptileLover82-reference.png', src= 'imgs/15/01/02/ReptileLover82-reference.png'))
        h1('Updated ', strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
        #p(panz)
    
    

with dignzdoc:
    with div(id='body').add(ol()):
        for rea in range(0, rele):
            print(rea)
            h3(lenres[rea]['title'])
            #if 'http' in (lenres[rea]['large_thumbnail_url']):
            #    print(lenres[rea]['large_thumbnail_url'])
            #else:
            #    p(lenres[rea]['large_thumbnail_url'])
            #p(img(str(lenres[rea]['thumbnail_url']), src = str((lenres[rea]['large_thumbnail_url'])))         
            #p(lenres[rea]['description'])
            #a(lenres[rea]['source'])


                
            #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('Gify is open source')
        a('https://github.com/getsdrawn/getsdrawndotcom')
        a('https://reddit.com/r/redditgetsdrawn')

#print doc
print (lenres[rea]['large_thumbnail_url'])
print(dignzdoc)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1806028196402528, 'fraction_numerical': 0.008264462809917356, 'mean_word_length': 3.2775467775467777, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '531327', 'license': 'MIT', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1524, 'n_words': 219, 'path': 'diginz.ipynb', 'repo_name': 'wcmckee/ece-display', 'size': '4114'}