Provides helper methods for connecting to the docker client.
Nitter Docker container object
hostIPv4Address - The host address the docker container will bind too.
portint - The port the docker container will listen to.
tempfileTemporaryFile - A TemporaryFile file generated from a template.
containerContainer - Local representation of a container object. Holds the started instance of a docker container.
addressstr - The full address of the docker container.
portsdict[int, int] - Binds the listening port to the nitter docker container's internal port 8080.
config_filepathstr - Path name to the generated tempfile.
volumesdict[str, dict[str, str]] - used to configure a bind volume.
| def get_profile(username: str, not_found_ok: bool = False)
Scrapes nitter for the target users profile information.
This is a modified version of nitter_scraper.profile.get_profile(). This version automatically uses the address of the docker container as the primary address to scrape profile data.
username- The target profiles username.
not_found_ok- If not_found_ok is false (the default), a ValueError is raised if the target profile doesn't exist. If not_found_ok is true, None will be returned instead.
Profile object if successfully scraped, otherwise None.
ValueError- If the target profile does not exist and the not_found_ok argument is false.
| def get_tweets(username: str, pages: int = 25, break_on_tweet_id: Optional[int] = None)
Gets the target users tweets
This is a modified version of nitter_scraper.tweets.get_tweets(). This version automatically uses the address of the docker container as the primary address to scrape profile data.
username- Targeted users username.
pages- Max number of pages to lookback starting from the latest tweet.
break_on_tweet_id- Gives the ability to break out of a loop if a tweets id is found.
address- The address to scrape from. The default is https://nitter.net which should be used as a fallback address.
| def start()
Starts the docker the container
| def stop()
Stops the docker the container
def NitterScraper(host: str = "0.0.0.0", port: int = 8080)
The NitterScraper context manager.
Takes care of configuring, starting, and stopping a docker instance of nitter.
host- The host address the docker container will bind too.
port- The port the docker container will listen to.
Nitter- An object representing a started nitter docker container.