728x90
반응형
- 2023-09-18 : First posting.
@hxxax__ 혜안 몰리와 띵띵땅땅 댄스
♬ 오리지널 사운드 - 혜안
### https://vt.tiktok.com/(\w+)/ 형태의 URI 일 경우.
이건 web client 를 돌리는 경우에만 iframe 형태의 Full URI 로 뽑아낼 수 있는거 같음.
아래는 FullURI 끄집어내는 code 일부분.
```[.linenums.lang-java]
RecoeveWebClient recoeveWebClient=new RecoeveWebClient();
recoeveWebClient.webClient.headAbs(shortURI)
.send()
.onSuccess(response -> {
if (response.statusCode()==200) {
// The response is a redirect, so get the followedRedirects().
List<String> followedURIs=response.followedRedirects();
String fullURI=followedURIs.get(followedURIs.size()-1);
System.out.println("Full TikTok URL: "+fullURI);
pl.req.response().putHeader("Content-Type","text/plain; charset=utf-8")
.end(fullURI, ENCODING);
}
else {
System.out.println("Sended shortURI.");
pl.req.response().putHeader("Content-Type","text/plain; charset=utf-8")
.end(shortURI, ENCODING);
}
recoeveWebClient.webClient.close();
})
.onFailure(throwable -> {
throwable.printStackTrace();
System.out.println("Sended shortURI.");
pl.req.response().putHeader("Content-Type","text/plain; charset=utf-8")
.end(shortURI, ENCODING);
recoeveWebClient.webClient.close();
});
```/
아래는
RecoeveWebClient.java
File.
```[.linenums.lang-java]
package recoeve.http;
import io.vertx.ext.web.client.HttpResponse;
import io.vertx.ext.web.client.WebClient;
import io.vertx.ext.web.client.WebClientOptions;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class RecoeveWebClient {
public static final WebClientOptions options=new WebClientOptions().setMaxHeaderSize(16384).setFollowRedirects(true);
public WebClient webClient;
public long timerId;
public int timerN;
public RecoeveWebClient() {
webClient=WebClient.create(Recoeve.vertx, options);
timerN=0;
}
public void doUntilH1IsFound(HttpResponse response, PrintLog pl, int delay) {
timerId=Recoeve.vertx.setTimer(delay, timerHandler -> {
timerN++;
if (response.statusCode()==200) {
String body=response.bodyAsString();
Document document=Jsoup.parse(body);
// Select the first <h1> element and extract its text content
Elements h1Elements=document.select("title, h1");
if (h1Elements.isEmpty()&&timerN<7) {
doUntilH1IsFound(response, pl, delay+512);
}
else {
if (!h1Elements.isEmpty()) {
Element firstH1Element=h1Elements.first();
String h1Text=firstH1Element.text();
System.out.println("Content of the first <h1> tag: "+h1Text);
pl.req.response().putHeader("Content-Type","text/plain; charset=utf-8")
.end(h1Text, Recoeve.ENCODING);
}
else {
System.out.println("No <h1> tags found on the page.");
pl.req.response().putHeader("Content-Type","text/plain; charset=utf-8")
.end("No <h1> tag.", Recoeve.ENCODING);
}
}
}
});
}
public static void main(String... args) {
// Do nothing.
}
}
```/
### Recoeve.net 이용하기
다음과 같은 링크로 연결하면 https://recoeve.net/reco?uri=https://www.tiktok.com/@ganadaba/video/7280762870080556306&title=230527 ITZY - Cheshire 유나 직캠 2023 드림콘서트 #itzy #fancam #cheshire #dreamconcert #yuna&cats=[Music/Break]--K-Pop--FanCam 아래와 같이 뜸.
Recoeve.net 에 가입해서 TikTok URI 를 reco 하고 drag copy & paste (드래그 후 복붙) 로 블로그 같은데 긁어넣으면 됨. (요새 WYSWYG (What You See is What You Get) 편집기들이 바뀌어서 제대로 복붙이 안되는듯 ㅡㅜ)
## weverse.io
scrolling="yes" 가 중요함. 그래야 화면이 잘려도 스크롤바가 생김.
```[.linenums.lang-html]
<style>
.rC {margin:.5em 0}
.rC>.rSC {position:relative; height:0; padding-bottom:63%}
.rC>.rSC>* {position:absolute; width:100%; height:100%; max-width:100%; max-height:100%; left:0; top:0; overflow-x:hidden; overflow-y:hidden}
</style>
<div class="rC"><div class="rSC">
<iframe delayed-src="https://weverse.io/lesserafim/artist/3-133358981" frameborder="0" scrolling="yes"></iframe>
</div></div>
```/
728x90
반응형
'[IT/Programming] > HTML related' 카테고리의 다른 글
트위터 트윗 퍼오기 (Embedding Twitter Tweet) (0) | 2023.10.25 |
---|---|
<link ref="canonical" href="..." /> 설정하기 (DISQUS config 활용) (0) | 2023.10.25 |
Mouse click 들 (left, right, wheel, wheel up, wheel down, back, forward) 구분해내기 (1) | 2023.10.25 |
댓글 플러그인 | 위젯 (SNS comment plug-in | widget) (3) | 2023.10.24 |
Learning Vert.x (0) | 2023.05.30 |
HTML docuK format ver. 2.1, short copiable version (2023-05-30) (0) | 2023.05.30 |
Interactive graph and chart in HTML (0) | 2023.03.10 |