timeline-tweet.html 5.7 KB

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