{"id":18318716,"url":"https://github.com/xdevplatform/tweet-search","last_synced_at":"2025-10-06T04:10:45.868Z","repository":{"id":27853226,"uuid":"31343706","full_name":"xdevplatform/tweet-search","owner":"xdevplatform","description":"Sample code showing Tweet activity volume using Twitter's Enterprise full-archive search API. Built with Django, Tweet embeds and C3.","archived":false,"fork":false,"pushed_at":"2021-06-10T17:45:05.000Z","size":1470,"stargazers_count":41,"open_issues_count":13,"forks_count":17,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-07-24T01:52:34.935Z","etag":null,"topics":["django","enterprise","python","search","twitter","twitter-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/xdevplatform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-26T00:49:51.000Z","updated_at":"2024-08-02T02:19:42.000Z","dependencies_parsed_at":"2022-09-03T15:02:31.153Z","dependency_job_id":null,"html_url":"https://github.com/xdevplatform/tweet-search","commit_stats":null,"previous_names":["xdevplatform/tweet-search"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xdevplatform/tweet-search","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftweet-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftweet-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftweet-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftweet-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xdevplatform","download_url":"https://codeload.github.com/xdevplatform/tweet-search/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftweet-search/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278556754,"owners_count":26006204,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["django","enterprise","python","search","twitter","twitter-api"],"created_at":"2024-11-05T18:11:22.398Z","updated_at":"2025-10-06T04:10:45.807Z","avatar_url":"https://github.com/xdevplatform.png","language":"JavaScript","readme":"Tweet Search\n=================\n\nThis sample uses GNIP full archive search to show the activity volume and latest tweets on any given topic. It also renders tweets using Twitter's widgets.js.\n\n\u003cimg src=\"screenshot.png\" style=\"width: 70%;\"/\u003e\n\nAs always, when developing on top of the Twitter platform, you must abide by the [Developer Agreement \u0026 Policy](https://dev.twitter.com/overview/terms/agreement-and-policy). \n\n[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/twitterdev/tweet-search)\n\n\nRequirements\n============\n\nTo run this sample code, you can install the required libraries with:\n\n\t`pip install -r requirements.txt`\n\nGetting Started\n============\n\n- Create a Twitter App (https://apps.twitter.com/). Also, ensure that the Callback URL is populated. This can point to http://localhost:9000 to start. If it is not included, you will get Client Authorization errors upon login.\n\n- Specify your API and GNIP credentials in app/settings_my.py under the following section:\n\n    `GNIP_USERNAME = 'YOUR_GNIP_USERNAME'`\n    \n    `GNIP_PASSWORD = 'YOUR_GNIP_PASSWORD'`\n    \n    `GNIP_SEARCH_ENDPOINT = 'YOUR_GNIP_FULL_ARCHIVE_SEARCH_ENDPOINT'`\n\t\n- To initialize your database, run the from the `tweet-search` directory:\n\n  `python manage.py syncdb --settings=app.settings_my`\n  \n  Then run:\n  \n  `python manage.py migrate --settings=app.settings_my`\n\n- To start the server, run the following from the `tweet-search` directory:\n\n  `fab start`\n  \n- Open a browser and go to http://localhost:9000\n\nNote that the GNIP_SEARCH_ENDPOINT is a URL to the full archive search URL, and is in the format `https://data-api.twitter.com/search/fullarchive/...`.\nIf you want to use the 30-day search, open the `gnip_search_api.py` file, search for the term \"30 DAY\" and follow the instructions. (You also need to \nuse the 30-day search URL, and not the full arhive search URL.)\n\nInvalidate Twitter tokens \n--------\n\nFor security, this code sample has a batch process to clear out Twitter auth tokens for users that either:\n\n- Have a login of greater than 30 days ago, or \n- Have never logged in and joined greater than 30 days ago\n\nTo run the process, simply execute:\n\n\t`fab invalidate'\n\nDeploying to Heroku\n============\n\nDeploying to Heroku is even easier.  \n\n- Create a Twitter App (https://apps.twitter.com/)\n- Click on the Heroku button below\n- When prompted during the Heroku install, specify your:\n\n\t- CONSUMER_KEY\n\t- CONSUMER_SECRET\n\t- ACCESS_TOKEN\n\t- ACCESS_TOKEN_SECRET\n\t\n- After deploying, in the Twitter App config, ensure the Callback URL is `http://your-app-name.herokuapp.com/complete/twitter`\n\n- To sync the database, use the Heroku CLI and run the following:\n\n\t`heroku run python manage.py migrate --app your-app-name`\n\t\n- Open a browser and go to the URL specified by your deploy (http://your-app-name.herokuapp.com)\n\n- To create an admin user, use the following Heroku CLI command:\n\n\t`heroku run python manage.py createsuperuser --username=USERNAME --email=EMAIL --app your-app-name`\n\t\nThen log in via the Admin console and update your initial Twitter login user accordingly. \n\nInvalidating Twitter tokens on Heroku\n--------\n\nTo ensure the token invalidation script works properly on Heroku, run the following from your machine: \n\n\t`heroku run fab invalidate --app=MY_APP_NAME'\n\t\nIf this runs properly, follow the below steps to run it as a scheduled job on Heroku:\n\n- Run `heroku addons:add scheduler:standard --app=MY_APP_NAME`\n- Log into heroku.com, open your app and go to \"Resources\"\n- Click on \"Heroku Scheduler\" and then \"Add a New Job\"\n- Type in `fab invalidate`\n\nConfirm successful execution by viewing the output in the Heroku app logs.\n\n\nSample Queries\n============\n\nSome sample queries to run:\n\n- Hashtag search (default AND): `#MLB #SFGiants`\n- Mention search, no retweets: `@TwitterDev -(is:retweet)`\n- Search with images/videos: `walking dead (has:media)`\n\nAdvanced Options\n============\n\nIn the UI, there is a link to show advanced options. Specifically:\n\n- Start/end dates. GNIP search allows a variable timeframe to search. For optimal results, 30 days will return a response in a reasonable timeframe.\n- Has media. This appends `(has:media)` to your query \n\n\u003cimg src=\"advanced.png\" style=\"width: 70%;\"/\u003e\n\nRelated Terms\n============\n\nThe GNIP search can also suggest additional related terms to add to your query. Click on the 'related terms' \nlink and a drop-down will appear to suggest (and add) additional terms to your query:\n\n\u003cimg src=\"terms.png\" style=\"width: 70%;\"/\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxdevplatform%2Ftweet-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxdevplatform%2Ftweet-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxdevplatform%2Ftweet-search/lists"}