Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crypto engagement top x #645

Closed
StephanAkkerman opened this issue Aug 28, 2024 · 4 comments
Closed

Crypto engagement top x #645

StephanAkkerman opened this issue Aug 28, 2024 · 4 comments
Labels
Difficulty: Medium 😐 This issue can be solved, but a decent amount of lines need to be changed New feature ⭐ New feature or request Priority: Low 🥉 Assign this label if this issue is used once every few days

Comments

@StephanAkkerman
Copy link
Owner

StephanAkkerman commented Aug 28, 2024

https://lunarcrush.com/categories/cryptocurrencies
Sorted on altrank might be more interesting: https://lunarcrush.com/categories/cryptocurrencies?metric=alt_rank&filter=&network=&rpp=20&page=1&cols=&reverse=0

@StephanAkkerman StephanAkkerman added Priority: Low 🥉 Assign this label if this issue is used once every few days New feature ⭐ New feature or request Difficulty: Medium 😐 This issue can be solved, but a decent amount of lines need to be changed labels Aug 28, 2024
@StephanAkkerman
Copy link
Owner Author

Would be better if we can construct the query ourselves, so that we do not need to share deviceID etc.

@StephanAkkerman
Copy link
Owner Author

We can use playwright for this:

from playwright.sync_api import sync_playwright


def capture_requests(url, target_url_substring):
    with sync_playwright() as p:
        # Launch a browser (Chromium in this case)
        browser = p.chromium.launch(headless=True)
        page = browser.new_page()

        # Store requests
        captured_requests = []

        # Listen for all network requests
        page.on(
            "request",
            lambda request: (
                captured_requests.append(request)
                if target_url_substring in request.url
                else None
            ),
        )

        # Visit the website
        page.goto(url)

        # Wait for the page to load completely
        page.wait_for_load_state("networkidle")

        # Filter captured requests by the target URL substring
        filtered_requests = [
            r for r in captured_requests if target_url_substring in r.url
        ]

        # Close the browser
        browser.close()

        return filtered_requests


# Example usage
url_to_visit = "https://lunarcrush.com/categories/cryptocurrencies"
target_request = "https://lunarcrush.com/api3/auth/request-access?requestAccess=lunar"  # Part of the URL to match
requests = capture_requests(url_to_visit, target_request)

for req in requests:
    print(f"URL: {req.url}, Method: {req.method}")

@StephanAkkerman
Copy link
Owner Author

Would add more libraries to the project and a more difficult installation process

@StephanAkkerman StephanAkkerman closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Medium 😐 This issue can be solved, but a decent amount of lines need to be changed New feature ⭐ New feature or request Priority: Low 🥉 Assign this label if this issue is used once every few days
Projects
None yet
Development

No branches or pull requests

1 participant