Spaces:
Sleeping
Sleeping
| <html> | |
| <head> | |
| <title>Twitter Scraper</title> | |
| <style> | |
| body { font-family: Arial; margin: 2rem; } | |
| .profile { margin-bottom: 2rem; } | |
| .tweet { margin-bottom: 1.5rem; border-bottom: 1px solid #ccc; padding-bottom: 1rem; } | |
| img.avatar { border-radius: 50%; height: 80px; } | |
| img.media { max-width: 400px; display: block; margin-top: 0.5rem; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Twitter Media Scraper</h1> | |
| <form method="post" action="/scrape"> | |
| <input type="text" name="username" placeholder="Enter Twitter username" required> | |
| <button type="submit">Fetch</button> | |
| </form> | |
| {% if error %} | |
| <p style="color: red;">Error: {{ error }}</p> | |
| {% endif %} | |
| {% if user_data %} | |
| <div class="profile"> | |
| <h2>{{ user_data.name }} (@{{ user_data.screen_name }})</h2> | |
| <img class="avatar" src="{{ user_data.avatar }}" alt="avatar"> | |
| <p>Blue Verified: {{ user_data.blue_verified }}</p> | |
| <p>Total Media Count: {{ user_data.media_count }}</p> | |
| </div> | |
| <div class="tweets"> | |
| <h3>Tweets with Media</h3> | |
| {% for post in user_data.posts %} | |
| <div class="tweet"> | |
| <p><strong>{{ post.created_at }}</strong></p> | |
| <p>{{ post.text }}</p> | |
| {% if post.media_url %} | |
| <img class="media" src="{{ post.media_url }}" alt="media"> | |
| {% endif %} | |
| </div> | |
| {% endfor %} | |
| </div> | |
| {% endif %} | |
| </body> | |
| </html> | |