Spaces:
Sleeping
Sleeping
File size: 1,649 Bytes
417e4b6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | <!DOCTYPE html>
<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>
|