{"id":13605890,"url":"https://github.com/Jefferson-Henrique/GetOldTweets-java","last_synced_at":"2025-04-12T05:35:02.558Z","repository":{"id":26700537,"uuid":"30157590","full_name":"Jefferson-Henrique/GetOldTweets-java","owner":"Jefferson-Henrique","description":"A project written in Java to get old tweets, it bypass some limitations of Twitter Official API.","archived":false,"fork":false,"pushed_at":"2017-07-29T06:15:57.000Z","size":2512,"stargazers_count":76,"open_issues_count":19,"forks_count":45,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-08-02T19:38:48.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jefferson-Henrique.png","metadata":{"files":{"readme":"README.md","changelog":"changelog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-01T19:53:31.000Z","updated_at":"2023-09-15T06:18:40.000Z","dependencies_parsed_at":"2022-09-12T16:00:48.437Z","dependency_job_id":null,"html_url":"https://github.com/Jefferson-Henrique/GetOldTweets-java","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jefferson-Henrique%2FGetOldTweets-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jefferson-Henrique%2FGetOldTweets-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jefferson-Henrique%2FGetOldTweets-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jefferson-Henrique%2FGetOldTweets-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jefferson-Henrique","download_url":"https://codeload.github.com/Jefferson-Henrique/GetOldTweets-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223498085,"owners_count":17155256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:01:03.954Z","updated_at":"2024-11-07T10:31:27.311Z","avatar_url":"https://github.com/Jefferson-Henrique.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Get Old Tweets Programatically\nA project written in Java to get old tweets, it bypass some limitations of Twitter Official API.\n\n## Details\nTwitter Official API has the bother limitation of time constraints, you can't get older tweets than a week. Some tools provide access to older tweets but in the most of them you have to spend some money before.\nI was searching other tools to do this job but I didn't found it, so after analyze how Twitter Search through browser works I understand its flow. Basically when you enter on Twitter page a scroll loader starts, if you scroll down you start to get more and more tweets, all through calls to a JSON provider. After mimic we get the best advantage of Twitter Search on browsers, it can search the deepest oldest tweets.\n\n## Components\n- **Tweet:** Model class to give some informations about a specific tweet.\n  - id (String)\n  - permalink (String)\n  - username (String)\n  - text (String)\n  - date (Date)\n  - retweets (int)\n  - favorites (int)\n  - mentions (String)\n  - hashtags (String)\n  - geo (String)\n\n- **TweetManager:** A manager class to help getting tweets in **Tweet**'s model.\n  - getTweets (**TwitterCriteria**): Return the list of tweets retrieved by using an instance of **TwitterCriteria**. \n\n- **TwitterCriteria:** A collection of search parameters to be used together with **TweetManager**.\n  - create: First method to be called, creates a new empty instance. \n  - setUsername (String): An optional specific username from a twitter account. Without \"@\".\n  - setSince (String. \"yyyy-mm-dd\"): A lower bound date to restrict search.\n  - setUntil (String. \"yyyy-mm-dd\"): An upper bound date to restrist search.\n  - setQuerySearch (String): A query text to be matched.\n  - setMaxTweets (int): The maximum number of tweets to be retrieved. If this number is unsetted or lower than 1 all possible tweets will be retrieved.\n  \n- **Main:** A simple class showing examples of use.\n\n- **Exporter:** A class to execute tweets search through command-line.\n\n- **got.jar:** A runnable jar to call **Exporter** class. The result goes to a generated csv file named \"output_got.csv\".\n\n## Examples of java use\n- Get tweets by username\n``` java\n    TwitterCriteria criteria = TwitterCriteria.create()\n\t\t\t\t.setUsername(\"barackobama\")\n\t\t\t\t.setMaxTweets(1);\n    Tweet t = TweetManager.getTweets(criteria).get(0);\n    System.out.println(t.getText());\n```    \n- Get tweets by query search\n``` java\n    TwitterCriteria criteria = TwitterCriteria.create()\n\t\t\t\t.setQuerySearch(\"europe refugees\")\n\t\t\t\t.setMaxTweets(1);\n    Tweet t = TweetManager.getTweets(criteria).get(0);\n    System.out.println(t.getText());\n```    \n- Get tweets by username and bound dates\n``` java\n    TwitterCriteria criteria = TwitterCriteria.create()\n\t\t\t\t.setUsername(\"barackobama\")\n\t\t\t\t.setSince(\"2015-09-10\")\n\t\t\t\t.setUntil(\"2015-09-12\")\n\t\t\t\t.setMaxTweets(1);\n    Tweet t = TweetManager.getTweets(criteria).get(0);\n    System.out.println(t.getText());\n```    \n\n## Examples of command-line use\n- Get help use\n```\n    java -jar got.jar -h\n``` \n- Get tweets by username\n```\n    java -jar got.jar username=barackobama maxtweets=1\n```    \n- Get tweets by query search\n```\n    java -jar got.jar querysearch=\"europe refugees\" maxtweets=1\n```    \n- Get tweets by username and bound dates\n```\n    java -jar got.jar username=barackobama since=2015-09-10 until=2015-09-12 maxtweets=1\n```    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJefferson-Henrique%2FGetOldTweets-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJefferson-Henrique%2FGetOldTweets-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJefferson-Henrique%2FGetOldTweets-java/lists"}