![]() ![]() write( ' \033 Done archiving from ' first_date ' to ' last_date ' \n') join( archive_dir, me '-Twitter_' last_date ext) # We put the date first so we can sort by date easily. # Collect only the info we need in a list of lists. # Fill a list with the tweets, with each tweet a dictionary.ĪllInfo. # Open the CSV file specified on the command line and read the field names. Print "filename username archive_directory"Īrchive_dir = re. Trailing slash optional.Įxt = '.md' # the extension to use for created filesĮxpand_tco_links = True # should we expand t.co links while archiving (slow)? `target_folder` is the directory where the archive.md files will be created. `username` is used for naming the files, needed for handling multiple accounts `filename.csv` is the name of the CSV file you exported from ThinkUp Requires three ordered arguments: tu2md.py filename.csv username target_folder write( 'Wrote tweet to ' month_path ' \n')Ĭonverts a ThinkUp CSV export to monthly archive files with Markdown formatting # Construct our string with a trailing separator, just in case of future tweets join( archive_dir, username '-' typename '_' date ext) # Now we have our dated tweets loop through them and write to diskįor date, tweets in dated_tweets. # Grab our date, and toss the tweet into our dated dictionaryĭate = dateutil. # Replace t.co links with expanded versionsįormatted_tweet = re. ![]() # Parse through our tweets and find their datesĭate_re = re. # archive_dir = os.path.join(root_dir, archive_directory) write( ' \033[KError expanding ' url ' \r')įileparts = re. write( ' \033[KNo expansion for ' final_url ' \r') # Utility function for expanding t.co links # Don't edit below here unless you know what you're doing Separator_re = r'\s -\s ' # IFTTT adds extra spaces, so have to use a regexįinal_separator = ' \n \n- \n \n' # What you want in your final montly archivesĮxpand_tco_links = True # Whether you want t.co links expanded or not (makes script run much slower, more error prone)Įxt = '.md' # Extension to use on archive filenames TODO: Escape hashtags (at least ones at the beginning of a line) to avoid Markdown formatting issuesĪrchive_dir = '/Users/ttscoff/Dropbox/nvALT2.2' # The sub-directory you want your monthly archives in If you don't want the overhead of expanding t.co links,īe sure to set expand_tco_links to false. That allows for very fast indexing and searching of your tweets. This works well with nvALT if you save your notes to Dropbox and then point this script to save It looks at the first argument passed for the file to read. ![]() Reads a Dropbox fileĪ certain format is expected by the script for the IFTTT template: This iteration by () 2012ĭesigned to operate via Hazel or other file watcher. This script parses a text file with archived tweets and sorts them into archive files based on month ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |