Program to monitor twitter spaces for when a given user speaks in or hosts a twitter space.
Project description
Stay up to date with Twitter Spaces
Explination
This tool uses Selenium Firefox webdriver to grab the spaces ID's which a specified user is speaking at or hosting. There are currently no unauthenticated api endpoints (both public or private) which allow you to view when a user is speaking in a space. For this reason, this library requires a twitter login to run.
It runs selenium in headless mode and scrapes from a users profile page.
The original motivation for this tool is to monitor users and make trades based on what they say in twitter spaces, but saw others online asking how to get these space ids so decided to share! Hope you enjoy.
Explination
This tool uses Selenium Firefox webdriver to grab the spaces ID's which a specified user is speaking at or hosting. There are currently no unauthenticated api endpoints (both public or private) which allow you to view when a user is speaking in a space. For this reason, this library requires a twitter login to run.
It runs selenium in headless mode and scrapes from a users profile page.
The original motivation for this tool is to monitor users and make trades based on what they say in twitter spaces, but saw others online asking how to get these space ids so decided to share! Hope you enjoy.
Installation
To install, you must have firefox downloaded on your computer. (Any error involving geckodriver means firefox is not in your path)
pip install Twitter-Spaces-Speaker-Lookup
Create a blank file called "login.json"
Open up firefox and log into twitter and navigate into your profile page.
Download a cookie grabbing extension (I use EditThisCookie2 for firefox) and copy all cookies.
Paste these cookies into login.json and you're good to go!
Example:
import importlib
speaker_lookup = importlib.import_module("Twitter-Spaces-Speaker-Lookup.speaker_lookup")
ts = speaker_lookup.Twitter_Spaces()
# Create a callback function which takes in a twitter_spaces_id to be run for each space the target user joins or
def example_callback(spaces_id):
print(f"New Space: '{spaces_id}'!")
monitor_user = 'elon2doge'
ts.monitor_user_for_spaces(monitor_user, example_callback)
// Whenever the monitored user speaks at or hosts a twitter space, your callback function will be called.
💙 Contributing
PR's are welcome !
Found a Bug ? Create an Issue.
💖 Like this project ?
Leave a ⭐ If you think this project is cool.
👨💻 Author
Chris Piper
🍁 Licence
ISC
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Twitter-Spaces-Speaker-Lookup-0.0.6.tar.gz.
File metadata
- Download URL: Twitter-Spaces-Speaker-Lookup-0.0.6.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f305881c9fe78bec63dc4ee4316f6267b279eb3908cb8edc00de9024ac7cdc7c
|
|
| MD5 |
14d3043f717034b20559495f3a4c8e6f
|
|
| BLAKE2b-256 |
8dc7c44d8f62b6f94d95e1659d082698a83f2505c50c424582d45429f04bb45d
|
File details
Details for the file Twitter_Spaces_Speaker_Lookup-0.0.6-py3-none-any.whl.
File metadata
- Download URL: Twitter_Spaces_Speaker_Lookup-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
639badfe808923ea395ecd68f29735fca2db7bcd68601a47d470b40bc3757fb1
|
|
| MD5 |
9686c1ce29a7e407d74cdbcb62e95fde
|
|
| BLAKE2b-256 |
0fc8b310a7d6ac4edad24cc9b6d2215dd0fff47020438fcbfb8ea69a3beb4f4a
|