def read_json(directory, data_files='data/js/tweets/*.js'):
    '''
    Scrape a twitter archive file.
    Inspiration from https://github.com/mshea/Parse-Twitter-Archive
    '''
    files = path.join(directory, data_files)

    for fname in iglob(files):
        with open(fname, 'r') as f:
            # Twitter's JSON first line is bogus
            data = f.readlines()[1:]
            data = "".join(data)
            tweetlist = json.loads(data)

        for tweet in tweetlist:
            yield tweet
def read_json ( directory , data_files = 'data/js/tweets/*.js' ) : files = path . join ( directory , data_files ) for fname in iglob ( files ) : with open ( fname , 'r' ) as f : data = f . readlines ( ) [ 1 : ] data = "" . join ( data ) tweetlist = json . loads ( data ) for tweet in tweetlist : yield tweet
Scrape a twitter archive file.
    Inspiration from https://github.com/mshea/Parse-Twitter-Archive