timeline-tweet.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <div class="dtc w-10">
  2. <img loading="lazy" src="{{ tweet.avi_icon_url }}" alt="Avi">
  3. </div>
  4. <div class="dtc w-90 v-top">
  5. <p class="w-100 mt0 pt0">
  6. <strong><a href="{{ tweet.author_url }}" class="w-100">{{ tweet.display_name }}</a></strong>
  7. {% if tweet.author_is_verified %}
  8. <small class="verified">[verified]</small>
  9. {% endif %}
  10. <a href="{{ tweet.author_url }}" class="silver">@{{ tweet.handle }}</a>
  11. <a href="{{ tweet.url }}">{{ tweet.created_at }}</a> [<a href="{{ tweet.source_url }}" target="tweet_{{ tweet.id }}">source</a>]
  12. </p>
  13. <p class="w-100">
  14. {% if tweet.html %}
  15. {{ tweet.html | safe }}
  16. {% else %}
  17. {{ tweet.text | replace('<', '&lt;') | replace('\n', '<br>') | safe }}
  18. {% endif %}
  19. </p>
  20. {% if tweet.quoted_tweet %}
  21. <div class="dt qt-box">
  22. <div class="dt-row">
  23. {% with tweet = tweet.quoted_tweet %}
  24. {% include "partial/timeline-tweet.html" %}
  25. {% endwith %}
  26. </div>
  27. </div>
  28. {% endif %}
  29. {% if not skip_embed_replies %}
  30. {% if tweet.replied_tweet %}
  31. <p style="color: silver">
  32. Replying to:
  33. </p>
  34. <div class="reply_to w-100" style="border: 1px solid silver; padding: 6px">
  35. <div class="dt reply-box">
  36. <div class="dt-row">
  37. {% with tweet = tweet.replied_tweet %}
  38. {% include "partial/timeline-tweet.html" %}
  39. {% endwith %}
  40. </div>
  41. </div>
  42. </div>
  43. {% elif tweet.replied_tweet_id %}
  44. <p style="color: silver">
  45. Replying to:
  46. </p>
  47. {% if tweet.actions.view_replied_tweet %}
  48. <p class="reply_to w-100" style="border: 1px solid silver; padding: 6px">
  49. <a href="{{ url_for(tweet.actions.view_replied_tweet.route, **tweet.actions.view_replies.route_params) }}">View in Thread</a>.
  50. </p>
  51. {% endif %}
  52. {% endif %}
  53. {% endif %}
  54. {% if tweet.note %}
  55. <p class="note w-100" style="border: 1px solid black; background-color: yellow; padding: 6px">
  56. {{ tweet.note.replace('\n', '<br>') | safe }}
  57. </p>
  58. {% endif %}
  59. {% if tweet.photos %}
  60. <p class="w-100">
  61. <ul>
  62. {% for photo in tweet.photos %}
  63. <li><img loading="lazy" class="w-100" src="{{ photo.preview_image_url }}" crossorigin="" referrerpolicy="no-referrer" onclick="this.src='{{ photo.url }}'" style="max-height: {{ photo.height }};""></li>
  64. {% endfor %}
  65. </ul>
  66. </p>
  67. {% endif %}
  68. {% if tweet.videos %}
  69. <p class="w-100">
  70. <p>VIDEOS</p>
  71. <ul>
  72. {% for video in tweet.videos %}
  73. <li><img loading="lazy" class="w-100"
  74. src="{{ video.preview_image_url }}" referrerpolicy="no-referrer"
  75. {% if video.image_url %}
  76. onclick="this.src='{{ video.image_url }}'; this.onclick = undefined"
  77. {% endif %}
  78. {% if video.url %}
  79. ondblclick="swapVideoPlayer(this, '{{ video.url }}', '{{ video.content_type }}')"
  80. {% endif %}
  81. style="max-height: {{ video.height }};"
  82. >
  83. <dl>
  84. {% if video.duration_str %}
  85. <dt>Duration</dt>
  86. <dd>{{ video.duration_str }}</dt>
  87. {% elif video.duration_ms %}
  88. <dt>Duration</dt>
  89. <dd>{{ video.duration_ms / 1000 / 60 }} minutes</dt>
  90. {% endif %}
  91. </dl>
  92. {% if video.public_metrics and video.public_metrics.view_count %}
  93. <p class="w-100">
  94. view count: {{ video.public_metrics.view_count }}
  95. </p>
  96. {% endif %}
  97. </li>
  98. {% endfor %}
  99. </ul>
  100. </p>
  101. {% endif %}
  102. {% if tweet.card %}
  103. <div class="card-box w-100">
  104. <div style="display: flex; flex-direction: row;">
  105. {% if tweet.card.preview_image_url %}
  106. <img style="margin-right: 4px; max-height: 150px; max-width: 150px;" src="{{ tweet.card.preview_image_url }}">
  107. {% endif %}
  108. <div style="display: flex; flex-direction: column">
  109. <span><a href="{{ tweet.card.source_url }}">{{ tweet.card.display_url }}</a></span>
  110. <span><strong>{{ tweet.card.title }}</strong></span>
  111. <p>{{ tweet.card.content }}</p>
  112. </div>
  113. </div>
  114. </div>
  115. {% endif %}
  116. {% if False and tweet.replied_tweet %}
  117. <a href="{{ tweet.replied_tweet.url }}">View Parent</a>
  118. <a href="{{ url_for('.get_tweet_html', tweet_id=tweet.replied_tweet.conversation_id) }}">View Conversation</a>
  119. {% endif %}
  120. {% if tweet.public_metrics %}
  121. <p class="w-100">
  122. {% for k, v in tweet.public_metrics.items() %}
  123. {% if v != None %}
  124. {{ k.replace('_count', 's').replace('ys', 'ies').replace('_', ' ') }}: {{ v }},
  125. {% endif %}
  126. {% endfor %}
  127. </p>
  128. {% endif %}
  129. {% if tweet.non_public_metrics %}
  130. <p class="w-100">
  131. {% for k, v in tweet.non_public_metrics.items() %}
  132. {% if v != None %}
  133. {{ k.replace('_count', 's').replace('ys', 'ies').replace('_', ' ') }}: {{ v }},
  134. {% endif %}
  135. {% endfor %}
  136. </p>
  137. {% endif %}
  138. {% if tweet.attachments %}
  139. <ul>
  140. {% for a in tweet.attachments %}
  141. {% if a.content_type == 'application/vnd-hogumathi.livestream-details+json' %}
  142. <li class="livestream-details">
  143. <dl>
  144. {% if a.content.scheduled_start_time %}
  145. <dt>Scheduled Start Time</dt>
  146. <dd>{{ a.content.scheduled_start_time }}</dd>
  147. {% endif %}
  148. {% if a.content.start_time %}
  149. <dt>Start Time</dt>
  150. <dd>{{ a.content.start_time }}</dd>
  151. {% endif %}
  152. {% if a.content.chat_embed_url %}
  153. <dt>Chat</dt>
  154. <dd>
  155. <iframe class="w-100" height="400" src="{{ a.content.chat_embed_url }}" referrerpolicy="origin"></iframe>
  156. </dd>
  157. {% endif %}
  158. </dl>
  159. </li>
  160. {% else %}
  161. <li><a href="{{ a.url }}">{{ a.name }}</a> {{ a.content_type }} ({{ a.size }})
  162. {% endif %}
  163. </li>
  164. {% endfor %}
  165. </ul>
  166. {% endif %}
  167. {% if show_conversation_id %}
  168. <p class="w-100">
  169. Conversation: {{ tweet.conversation_id }}
  170. </p>
  171. {% endif %}
  172. </div>