본문 바로가기

puppeteer 테스트

2020. 8. 19. 13:33

네이버블로그 시절 고대유물 복원

============================================

 

 

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
var puppeteer = require("puppeteer");
var fs = require("fs");
var n = 0;
 
var dt = '<html><head><link rel="stylesheet" type="text/css" href="test2.css"></head><body style = "font-family: Whitney, Apple SD Gothic Neo, NanumBarunGothic, 맑은 고딕, Malgun Gothic, Gulim, 굴림, Dotum, 돋움, Helvetica Neue, Helvetica, Arial, sans-serif;"><div id="app-mount" class="appMount-3VJmYg"><div class="app-19_DXt platform-web"><div class="app flex-vertical theme-dark"><div class="message-group hide-overflow compact"><div class="comment">';
 
puppeteer.launch().then(async browser =>
{
    for(var i = 0; i < 3; i++)
    {
        n += 25;
 
        var strNm = "최박사" + " ";
        var strCt = "흐트믈테스트ㅡㅡㅡㅡ";
 
        dt += '<div class="message-text"><div class="markup"></span><span class="username-wrapper"><strong class="user-name">' + strNm + '</strong><i class="highlight-separator right-pad"> : </i></span><span class="message-content">' + strCt + '</span></div></div>';
    }
    console.log(true);
 
    dt += '</div></div></div></div></div></body></html>';
 
    await fs.writeFileSync("test.html", dt, 'utf-8');
 
    try
    {
        var page = await browser.newPage();
        await page.goto("file:///C:/Users/Choi/Documents/DISCORD_BOT/Archive_BOT/test.html");
        await page.screenshot({path : "screenshot.png", clip : {x : 10, y : 0, width : 500, height : n}});
    }
    catch(e)
    {
        console.log(e);
    }
 
 
    await browser.close();  
});
 
cs

 

1
<html><head><link rel="stylesheet" type="text/css" href="test2.css"></head><body style = "font-family: Whitney, Apple SD Gothic Neo, NanumBarunGothic, 맑은 고딕, Malgun Gothic, Gulim, 굴림, Dotum, 돋움, Helvetica Neue, Helvetica, Arial, sans-serif;"><div id="app-mount" class="appMount-3VJmYg"><div class="app-19_DXt platform-web"><div class="app flex-vertical theme-dark"><div class="message-group hide-overflow compact"><div class="comment"><div class="message-text"><div class="markup"></span><span class="username-wrapper"><strong class="user-name">최박사 </strong><i class="highlight-separator right-pad"> : </i></span><span class="message-content">흐트믈테스트ㅡㅡㅡㅡ</span></div></div><div class="message-text"><div class="markup"></span><span class="username-wrapper"><strong class="user-name">최박사 </strong><i class="highlight-separator right-pad"> : </i></span><span class="message-content">흐트믈테스트ㅡㅡㅡㅡ</span></div></div><div class="message-text"><div class="markup"></span><span class="username-wrapper"><strong class="user-name">최박사 </strong><i class="highlight-separator right-pad"> : </i></span><span class="message-content">흐트믈테스트ㅡㅡㅡㅡ</span></div></div></div></div></div></div></div></body></html>
cs

 

 

저거하나한다고 디스코드 뜯어서 처음해보는 흐트믈이랑 css 잡고 야자 4시간동안 삽질함

이제 이거 박제봇에 이식시켜야대는데 미치겟네

댓글