{"id":13419721,"url":"https://github.com/edmondburnett/twitter-text-python","last_synced_at":"2025-03-15T05:32:49.479Z","repository":{"id":10807732,"uuid":"13081256","full_name":"edmondburnett/twitter-text-python","owner":"edmondburnett","description":"Twitter text processing library (auto linking and extraction of usernames, lists and hashtags).","archived":true,"fork":false,"pushed_at":"2024-12-05T02:43:23.000Z","size":92,"stargazers_count":179,"open_issues_count":0,"forks_count":35,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-08T10:11:26.104Z","etag":null,"topics":["twitter","twitter-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dgeb/grunt-ember-templates","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edmondburnett.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2013-09-25T01:40:23.000Z","updated_at":"2024-12-05T15:44:10.000Z","dependencies_parsed_at":"2022-09-24T06:22:19.457Z","dependency_job_id":null,"html_url":"https://github.com/edmondburnett/twitter-text-python","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edmondburnett%2Ftwitter-text-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edmondburnett%2Ftwitter-text-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edmondburnett%2Ftwitter-text-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edmondburnett%2Ftwitter-text-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edmondburnett","download_url":"https://codeload.github.com/edmondburnett/twitter-text-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690112,"owners_count":20331726,"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":["twitter","twitter-api"],"created_at":"2024-07-30T22:01:19.823Z","updated_at":"2025-03-15T05:32:49.473Z","avatar_url":"https://github.com/edmondburnett.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![CircleCI](https://flat.badgen.net/circleci/github/edmondburnett/twitter-text-python)](https://circleci.com/gh/edmondburnett/twitter-text-python) [![PyPI version](https://flat.badgen.net/pypi/v/twitter-text-python)](https://pypi.org/project/twitter-text-python/)\n\n\ntwitter-text-python\n===================\n\n**twitter-text-python** is a Tweet parser and formatter for Python. Extract\nusers, hashtags, URLs and format as HTML for display.\n\n**Note**: Since the Twitter public API was effectively killed by the new ownership, and the paywall makes testing and development impractical, this module will no longer be actively maintained. It should work fine with any existing API data.\n\nPyPI release: [https://pypi.org/project/twitter-text-python/](https://pypi.org/project/twitter-text-python/)\n\n\ninstallation\n------------\n\n    $ pip install twitter-text-python\n\n\ncompatibility\n-------------\n\ntwitter-text-python has been tested with Python 2.6, 2.7, 3.3, 3.4, 3.5, and 3.7.\n\n\nusage\n-----\n\n```python\n\u003e\u003e\u003e from ttp import ttp\n\u003e\u003e\u003e p = ttp.Parser()\n\u003e\u003e\u003e result = p.parse(\"@burnettedmond, you now support #IvoWertzel's tweet parser! https://github.com/edmondburnett/\")\n\u003e\u003e\u003e result.reply\n'burnettedmond'\n\u003e\u003e\u003e result.users\n['burnettedmond']\n\u003e\u003e\u003e result.tags\n['IvoWertzel']\n\u003e\u003e\u003e result.urls\n['https://github.com/edmondburnett/']\n\u003e\u003e\u003e result.html\nu'\u003ca href=\"http://twitter.com/burnettedmond\"\u003e@burnettedmond\u003c/a\u003e, you now support \u003ca href=\"https://twitter.com/search?q=%23IvoWertzel\"\u003e#IvoWertzel\u003c/a\u003e\\'s tweet parser! \u003ca href=\"https://github.com/edmondburnett/\"\u003ehttps://github.com/edmondburnett/\u003c/a\u003e'\n```\n\nIf you need different HTML output just subclass and override the `format_*` methods.\n\nYou can also ask for the span tags to be returned for each entity:\n\n```python\n\u003e\u003e\u003e p = ttp.Parser(include_spans=True)\n\u003e\u003e\u003e result = p.parse(\"@burnettedmond, you now support #IvoWertzel's tweet parser! https://github.com/edmondburnett/\")\n\u003e\u003e\u003e result.urls\n[('https://github.com/edmondburnett/', (57, 87))]\n```\n\n\nTo use the shortlink follower (depends on the [Requests](http://docs.python-requests.org/) library):\n\n```python\n\u003e\u003e\u003e from ttp import utils\n\u003e\u003e\u003e # assume that result.urls == ['http://t.co/8o0z9BbEMu', u'http://bbc.in/16dClPF']\n\u003e\u003e\u003e print utils.follow_shortlinks(result.urls)  # pass in list of shortlink URLs\n{'http://t.co/8o0z9BbEMu': [u'http://t.co/8o0z9BbEMu', u'http://bbc.in/16dClPF', u'http://www.bbc.co.uk/sport/0/21711199#TWEET650562'], u'http://bbc.in/16dClPF': [u'http://bbc.in/16dClPF', u'http://www.bbc.co.uk/sport/0/21711199#TWEET650562']}\n \u003e\u003e\u003e # note that bad shortlink URLs have a key to an empty list (lost/forgotten shortlink URLs don't generate any error)\n```\n\n\nchangelog\n---------\n\n* 2019/02/17 1.1.1 Minor release to fix Python 3 support for utils.py, test with 3.7\n* 2015/04/11 1.1.0 Add basic support for Python 3\n* 2014/07/30 1.0.3 Update parsed URLs for Twitter API 1.1 compatibility\n* 2013/06/01 1.0.1 new working version, adding comma parse fix (thanks https://github.com/muckrack), used autopep8 to clean the src, added a shortlink expander\n* 2013/02/11 1.0.0.2 released to PyPI\n\n\ntests\n-----\n\nRun the unit tests:\n\n    $ python ttp/tests.py\n    ....................................................................................................\n    ----------------------------------------------------------------------\n    Ran 100 tests in 0.009s\n    OK\n\nOr test on multiple Python versions with tox:\n\n    $ pip install tox\n    $ tox\n\n\ncontributing\n------------\n\nSee the relevant [wiki\npage](https://github.com/edmondburnett/twitter-text-python/wiki/Contributing) for\nnotes on contributing to **twitter-text-python**.\n\n\nhistory\n-------\n\nThe current version was forked by Edmond Burnett in July 2014:\nhttps://github.com/edmondburnett/twitter-text-python\n\nThe library was forked by Ian Ozsvald in January 2013 and released to PyPI,\nsome bugs were fixed, a few minor changes to functionality added (no longer\nsupported): https://github.com/ianozsvald/twitter-text-python\n\nThe original ttp comes from Ivo Wetzel (no longer supported):\nhttps://github.com/BonsaiDen/twitter-text-python\n\nOriginally based on\n[https://github.com/mzsanford/twitter-text-java](https://github.com/mzsanford/twitter-text-java).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedmondburnett%2Ftwitter-text-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedmondburnett%2Ftwitter-text-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedmondburnett%2Ftwitter-text-python/lists"}