str.lstrip

str.lstrip(...)

Description

Documentation for str.lstrip.

Python Python String Methods Official Docs

Real-World Examples

Practical code examples showing how str.lstrip is used in real projects.

]

    results = []

    for account in accounts.split(","):
        account = account.strip().lstrip("@")

        for instance in nitter_instances:
            try:
                url = f"https://{instance}/{account}"
                html = await _fetch_html(url)

                if not html:
                    continue

                # Parse tweets from HTML (simple extraction)
                # Nitter uses timeline-item class for tweets
                import re

                # Extract tweet content - look for tweet-content class
                tweet_pattern = r'<div class="tweet-content[^"]*"[^>]*>(.*?)</div>'
                tweets = re.findall(tweet_pattern, html, re.DOTALL)

                # Extract tweet links
                link_pattern = r'<a class="tweet-link"[^>]*href="([^"]*)"'
)
            time.sleep(wait_time)

    def get(self, endpoint: str, params: dict | None = None) -> dict | list | None:
        """Make a GET request to the GitHub API."""
        url = f"{self.BASE_URL}/{endpoint.lstrip('/')}"
        try:
            response = self.session.get(url, params=params)
            self._handle_rate_limit(response)

            if response.status_code == 403 and "rate limit" in response.text.lower():
                wait_time = max(0, self.rate_limit_reset - time.time()) + 1
                print(f"Rate limited, waiting {wait_time:.0f}s...")
                time.sleep(wait_time)
                return self.get(endpoint, params)

            if response.status_code == 200:
                return response.json()
            else:
                print(f"API error {response.status_code}: {response.text[:200]}")
                return None
        except requests.RequestException as e:
            print(f"Request error: {e}")
            return None