Skip to content

Migrate to 3.0.0

alkihis edited this page Jan 11, 2020 · 2 revisions

Here are a migration guide from 2.1.7 to 3.0.0 version of twitter-archive-reader.

New

TweetArchive

This new object now holds and manage tweets available inside the Twitter archive. It is accessible with the .tweets property of a TwitterArchive instance.

Available methods/properties are the same as the old tweet access way of a TwitterArchive instance.

New methods

  • [Symbol.iterator](): This object is iterable. It iterates over tweets.
  • .monthIterator(): A generator that allow iteration tweet per tweet sorted by year and month
  • .single(id: string): Replaces old TwitterArchive.id().

DMArchive

  • .with(user_id: string | string[]): Get conversations that include all the specified user ids.

Deprecated

TwitterArchive

  • .index: Tweet index is moved to .tweets.index and archive information/user to .info. It will be removed in a future release.

Tweet access properties and methods still exists on the TwitterArchive object, but are marked as deprecated. Please use the ones available on TweetArchive.

Changed

TwitterArchive

  • .loadArchivePart() became asynchronous. Don't forget to add await before calls to this method.
  • .raw now returns three archives: Loaded archive file, DM image ZIP (if loaded) and group DM image ZIP (if loaded).
  • .requiresDmImageZipLoad() is now a property, .requires_dm_image_load.
  • .archive_save_info is now named .synthetic_info
  • .hash() is now a property, .hash.

Moved

TwitterArchive

All the tweet access methods and property from TwitterArchive instances are moved to TweetArchive instance. It is accessible with the .tweets property.

Moved attributes are:

  • .all
  • .length
  • .month()
  • .between()
  • .fromThatDay()
  • .isGDPRTweet() (+ became static)

All of these are available in the TweetArchive instance.

Exported functions

dateFromTweet(), parseTwitterDate(), isWithMedia() and isWithVideo() are now static methods of TweetArchive. Access them with TweetArchive.<methodName>().

Removed

TwitterArchive

  • .importDmImageZip(), .importDmGroupImageZip() and .loadCurrentDmImageZip() are now private. Please use the new parameters of .loadArchivePart(): dm_image_file, dm_image_group_file and current_dm_images.