google image tag 변경

구글에서 이미지를 크롤링해오고 있었는데 최근에 코드가 다소 바뀌었다.

[예전소스]

<!DOCTYPE html><html itemscope=
.
.
.
<div class="rg_meta notranslate>
{"id":"vKrnn3ynVJtyCM:","isu":"jinoo.kr","itg":0,"ity":"","oh":300,"ou":"https://i1.daumcdn.net/thumb/C300x300/?fname\u003dhttps://k.kakaocdn.net/dn/pVpFz/btqytVZC5dN/X8jt70ACKWXrb0KkpRvtA1/img.jpg","ow":300,"pt":"아이유\u0027 카테고리의 글 목록","rh":"jinoo.kr","rid":"qeFimcMyYd5olM","rmt":0,"rt":0,"ru":"https://jinoo.kr/category/%EC%95%84%EC%9D%B4%EC%9C%A0","sc":1,"st":"지누바라기","th":225,"tu":"https://encrypted-tbn0.gstatic.com/images?q\u003dtbn:ANd9GcTLI__RnAfNxvU0VMMfCRYkgtLScGQeiwjq8kOBgZAAg6VJbyGx\u0026s","tw":225}
</div>

이런식으로 반복되는 부분이 존재했었다. json_decode 해서 보면

array (
  'id' => 'vKrnn3ynVJtyCM:',
  'isu' => 'jinoo.kr',
  'itg' => 0,
  'ity' => '',
  'oh' => 300,
  'ou' => 'https://i1.daumcdn.net/thumb/C300x300/?fname=https://k.kakaocdn.net/dn/pVpFz/btqytVZC5dN/X8jt70ACKWXrb0KkpRvtA1/img.jpg',
  'ow' => 300,
  'pt' => '아이유\' 카테고리의 글 목록',
  'rh' => 'jinoo.kr',
  'rid' => 'qeFimcMyYd5olM',
  'rmt' => 0,
  'rt' => 0,
  'ru' => 'https://jinoo.kr/category/%EC%95%84%EC%9D%B4%EC%9C%A0',
  'sc' => 1,
  'st' => '지누바라기',
  'th' => 225,
  'tu' => 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLI__RnAfNxvU0VMMfCRYkgtLScGQeiwjq8kOBgZAAg6VJbyGx&s',
  'tw' => 225,
)

ou에 원본이미지, tu에 썸네일이미지이고 나머지는 그외 각종 정보들이다. (출처, 크기 등)

하지만 지금은 하단에 스크립트 부분으로 대체되었다. 마지막 직전 스크립트를 보면 다음과 같은 부분이 있다.

[현재소스]

<<html lang="ko" dir="ltr" itemscope=""
.
.
.
AF_initDataCallback({key: 'ds:2', isError:  false , hash: '3', data:function(){return [null,[[["online_chips",[["wannaby",null,"/search?q\u003d%EC%9D%B4%EB%8D%B0%EA%B0%80%EB%AF%B8+%EB%B0%94%EC%BF%A0\u0026tbm\u003disch\u0026tbs\u003dift:gif\u0026chips\u003dq:%EC%9D%B4%EB%8D%B0%EA%B0%80%EB%AF%B8+%EB%B0%94%EC%BF%A0,online_chips:wannaby",null,null,[null,null,null,null,"q:이데가미 바쿠,online_chips:wannaby"],0],["요새",null,"/search?q\u003d%EC%9D%B4%EB%8D%B0%EA%B0%80%EB%AF%B8+%EB%B0%94%EC%BF%A0\u0026tbm\u003disch\u0026tbs\u003dift:gif\u0026chips\u003dq:%EC%9D%B4%EB%8D%B0%EA%B0%80%EB%AF%B8+%EB%B0%94%EC%BF%A0,online_chips:%EC%9A%94%EC%83%88",null,null,[null,null,null,null,"q:이데가미 바쿠,online_chips:요새"],1],["00 년생",null,"/search?q\u003d%EC%9D%B4%EB%8D%B0%EA%B0%80%EB%AF%B8+%EB%B0%94%EC%BF%A0\u0026tbm\u003disch\u0026tbs\u003dift:gif\u0026chips\u003dq:%EC%9D%B4%EB%8D%B0%EA%B0%80%EB%AF%B8+%EB%B0%94%EC%BF%A0,online_chips:00+%EB%85%84%EC%83%9D",null,null,[null,null,null,null,"q:이데가미 바쿠,online_chips:00 년생"],2]
.
.
.
(중략)
.
.
.

"2003":[null,"Zlm3tawJjvjyHM","http://www.inven.co.kr/board/webzine/2097/1183594","SNS 뒤흔들던 일본 아이돌 지망생 | 웹진 인벤 - 인벤",null,null,null,null,null,false,null,null,"인벤",null,null,null,null,null,null,null,null,null,false,false,false,null,null,null,"https://lh3.googleusercontent.com/proxy/SvosEhTDXa6NxhBMjNpQfhm2-5vdzsWhmqd37JWsymdGO48cxD8TX9Xc6hKl8bdS2M_1LbdCAi_rwmvDv5yoaDpokOIGOULb_UNdHC6jwq2UWBgUYHKW7Ow",{"26":[null,2]}],"2008":[null,"SNS 뒤흔들던 일본 아이돌 지망생 | 웹진 인벤 - 인벤"],"183836587":["inven.co.kr"]}],null,[178,234,5,null,null,169,298,null,null,-8,null,null,false,true,null,null,[]],0,null,null,"MPYHIP6f8JE42M",1,null,null,null,null,[[1581983621287136,182323286,3624773713],null,2],[null,null,1]],[1,[0,"QhPZ5OeK_OyBkM",["https://encrypted-tbn0.gstatic.com/images?q\u003dtbn%3AANd9GcQ8NtFdLBok-kfRQ_GkuT8ETxCebeNdW6CZxLIkd_eXFZrX6fSK",300,168],["http://optimal.inven.co.kr/upload/2019/04/08/bbs/i13761154133.gif",391,219],null,0,"rgb(34,50,72)",null,true,null,["https://encrypted-tbn0.gstatic.com/images?q\u003dtbn%3AANd9GcS29pYvecgnmHhpOtCwI0uSSezGR6qrYrQyM3etzK7xPBLs9Dbm",144,80],{"2001":[null,null,null,3,21,3,12,null,null,null,[]],"2003":[null,"Zlm3tawJjvjyHM","http://www.inven.co.kr/board/webzine/2097/1183594","SNS 뒤흔들던 일본 아이돌 지망생 | 웹진 인벤 - 인벤",null,null,null,null,null,false,null,null,"인벤",null,null,null,null,null,null,null,null,null,false,false,false,null,null,null,"https://lh3.googleusercontent.com/proxy/etvOKZKSn_3oSFzdukl55xWoN5sD1UnH34OsgmStChe_jS74WZ4kH-nljzg9WGLXpb93-wgVmUTH2ZFbO6LRO-8ELxCRK9XEWfPVoAhPAqxX3i2FXnFTDqU",{"26":[null,2]}],"2008":[null,"SNS 뒤흔들던 일본 아이돌 지망생 | 웹진 인벤 - 인벤"],"183836587":["inven.co.kr"]}],null,[177,234,5,null,null,168,300,null,null,-8,null,null,true,true,null,null,[]],1,null,null,"QhPZ5OeK_OyBkM",1,null,null,null,null,[[1581983621287136,182323286,3624773713],null,3],[null,null,1]],[1,[0,"A3mazVRb4Y0tYM",["https://encrypted-tbn0.gstatic.com/images?q\u003dtbn%3AANd9GcQzP3ryr_CWCalFzzAK0KE65x63KKqfJ6H7ZoOcYXk24eFVIFjq",298,169],["http://optimal.inven.co.kr/upload/2019/04/08/bbs/i13709105968.gif",390,222],null,0,"rgb(21,30,40)",null,true,null,["https://encrypted-tbn0.gstatic.com/images?q\u003dtbn%3AANd9GcQXbiFJLKnAmYAM44uXxVd_etKGsAydlpruzQPnv_NPvaZHS45o",144,80],{"2001":[null,null,null,0,21,0,0,null,null,null,[]],"2003":[null,"Zlm3tawJjvjyHM","http://www.inven.co.kr/board/webzine/2097/1183594","SNS 뒤흔들던 일본 아이돌 지망생 | 웹진 인벤 - 인벤",null,null,null,null,null,false,null,null,"인벤",null,null,null,null,null,null,null,null,null,false,false,false,null,null,null,"https://lh3.googleusercontent.com/proxy/GT0-7QkMi1NqF1jHIMgWE2f7VAP-Yy6fNZnMrDKaB_lTI0nzOF7WsPTJj7G1dX8t4Su9ozwvolXJE9yM7UuzqTSZYAmj4adDZpBW-LxWRO9H1yKO3V-Maeg",{"26":[null,2]}],"2008":[null,"SNS 뒤흔들던 일본 아이돌 지망생 | 웹진 인벤 - 인벤"],"183836587":["inven.co.kr"]}],null,[145,188,5,null,null,135,238,null,null,0,null,null,false,true,null,null,[]],2,null,null,"A3mazVRb4Y0tYM",1,null,null,null,null,[[1581983621287136,182323286,3624773713],null,4],[null,null,1]],[1,[0,"H0zoAvLai6GPNM",["https://encrypted-tbn0.gstatic.com/images?q\u003dtbn%3AANd9GcRVmeSpYn-wN65kMc6FdYReY4MKzEhfOQLROHU47c_YY5zmYe8W",202,249],["https://1.bp.blogspot.com/-uYXOU5YeYX8/XRhLy21IweI/AAAAAAAACDc/glZrNJER4QsfpiqV8kgMJOPq3BwdxeosgCLcBGAs/s1600/6.gif",462,570],null,0,"rgb(18,21,24)",null,true,null,["https://encrypted-tbn0.gstatic.com/images?q\u003dtbn%3AANd9GcTp5iVQestFd2IR1qb8dsS5jkRQqoKMRvdi440i0TgqqUziU9p3",144,176],{"2001":[null,null,null,0,6,9,12,null,null,null,[]]

저 부분을 json_decoding 하면 다음과 같은 결과를 얻을 수 있다.

[1, [0, "QhPZ5OeK_OyBkM", ["https://encrypted-tbn0.gstatic.com/images?q\u003dtbn%3AANd9GcQ8NtFdLBok-kfRQ_GkuT8ETxCebeNdW6CZxLIkd_eXFZrX6fSK", 300, 168],
        ["http://optimal.inven.co.kr/upload/2019/04/08/bbs/i13761154133.gif", 391, 219], null, 0, "rgb(34,50,72)", null, true, null, ["https://encrypted-tbn0.gstatic.com/images?q\u003dtbn%3AANd9GcS29pYvecgnmHhpOtCwI0uSSezGR6qrYrQyM3etzK7xPBLs9Dbm", 144, 80], {
            "2001": [null, null, null, 3, 21, 3, 12, null, null, null, []],
            "2003": [null, "Zlm3tawJjvjyHM", "http://www.inven.co.kr/board/webzine/2097/1183594", "SNS 뒤흔들던 일본 아이돌 지망생 | 웹진 인벤 - 인벤", null, null, null, null, null, false, null, null, "인벤", null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, "https://lh3.googleusercontent.com/proxy/etvOKZKSn_3oSFzdukl55xWoN5sD1UnH34OsgmStChe_jS74WZ4kH-nljzg9WGLXpb93-wgVmUTH2ZFbO6LRO-8ELxCRK9XEWfPVoAhPAqxX3i2FXnFTDqU", {
                "26": [null, 2]
            }],
            "2008": [null, "SNS 뒤흔들던 일본 아이돌 지망생 | 웹진 인벤 - 인벤"],
            "183836587": ["inven.co.kr"]
        }
    ], null, [177, 234, 5, null, null, 168, 300, null, null, -8, null, null, true, true, null, null, []], 1, null, null, "QhPZ5OeK_OyBkM", 1, null, null, null, null, [
        [1581983621287136, 182323286, 3624773713], null, 3
    ],
    [null, null, 1]
]

검색하면 586번 중에 12번이 예전 소스형태로 되어있고 나머지는 위와 같은 형태이다. 그래도 원본 이미지 주소가 있어서 참 다행이었다.

게시 범주: IT

댓글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다