[이윰] 카카오TV 올바르게 적용하기

페이지 정보

shadow2fox 1,842 1 1 2020.01.29 11:45

평점

본문

카카오TV 올바르게 적용하기
그누보드5/eyoom/classes/eyoom.class.php를 열어 동영상 key 추출하기를 검색하여 아래와 같이 수정한다.

수정 전

            case 'tvpot.daum.net':
            case 'tv.kakao.com':
                if ($src[1] && $src[2]) {
                    $video['key1'] = $src[1];
                    $video['key2'] = $src[2];
                } else {
                    $data = $this->get_video_use_curl($video_url, $host);
                    $video['key1'] = $data['vid'];
                    $video['key2'] = $data['imgsrc'];
                }
                break;
수정 후

            case 'tvpot.daum.net':
            case 'tv.kakao.com':
            case 'play-tv.kakao.com':
                if ($src[1] && $src[2]) {
                    $video['key1'] = $src[1];
                    $video['key2'] = $src[2];
                } else {
                    $data = $this->get_video_use_curl($video_url, $host);
                    $video['key1'] = $data['vid'];
                    $video['key2'] = $data['imgsrc'];
                }
                break;

// CURL를 활용한 동영상페이지 웹스크랩핑를 검색하여 아래와 같이 수정한다.

수정 전

            case 'tvpot.daum.net':
            case 'tv.kakao.com':
                preg_match('/\<meta property=\"og:url\"\scontent=\"(?P<vid>[a-zA-Z0-9:\/\._]+)\"/i', $output, $scrapping);
                $out['vid'] = $this->get_video_key($this->eyoom_host($scrapping['vid']));
                preg_match('/\<meta property=\"og:image\"\scontent=\"(?P<imgsrc>[a-zA-Z0-9:\/\._]+)/i', $output, $scrapping);
                $out['imgsrc'] = $scrapping['imgsrc'];
                return $out;
                break;
수정 후

            case 'tvpot.daum.net':
            case 'tv.kakao.com':
            case 'play-tv.kakao.com':
                preg_match('/\<meta property=\"og:url\"\scontent=\"(?P<vid>[a-zA-Z0-9:\/\._-]+)\"/i', $output, $scrapping);
                $out['vid'] = $this->get_video_key($this->eyoom_host($scrapping['vid']));
                preg_match('/\<meta property=\"og:image\"\scontent=\"(?P<imgsrc>[a-zA-Z0-9:\/\._]+)/i', $output, $scrapping);
                $out['imgsrc'] = $scrapping['imgsrc'];
                return $out;
                break;

// 수집된 동영상 정보를 iframe source로 구현을 검색하여 아래와 같이 수정한다.

수정 전

            case 'tvpot.daum.net':
            case 'tv.kakao.com':
                $source = '<iframe width="'.$video['width'].'" height="'.$video['height'].'" src="http://videofarm.daum.net/controller/video/viewer/Video.html?vid='.$video['key1'].'&play_loc=undefined&wmode=opaque" frameborder="0" scrolling="no"></iframe>';
                break;
수정 후

            case 'tvpot.daum.net':
            case 'tv.kakao.com':
            case 'play-tv.kakao.com':
                $source = '<iframe width="'.$video['width'].'" height="'.$video['height'].'" src="https://tv.kakao.com/embed/player/cliplink/'.$video['key1'].'?service=kakao_tv" allowfullscreen frameborder="0" scrolling="no" allow="autoplay"></iframe>';
                break;

URL로부터 동영상 이미지 경로를 찾기를 검색하여 아래와 같이 수정한다.

수정 전

            case 'tvpot.daum.net':
            case 'tv.kakao.com':
                $video['img_url'] = $video['key2'];
                break;
수정 후

            case 'tvpot.daum.net':
            case 'tv.kakao.com':
            case 'play-tv.kakao.com':
                $video['img_url'] = $video['key2'];
                break;
추천인 1
  • 하늘구장
10
shadow2fox - 회원등급 : 자연/Level 142 - 포인트 : 2,538,253
레벨 142
경험치 3,031,172

Progress Bar 66%

- 가입일 : 2015-03-10 12:21:44
- 서명 : 인간에게 가장 큰 선물은 자기 자신에게 기회를 주는 것이다. - 크리스 가드너, Chris Gardner -
- 자기소개 : There's never a shortcut to happiness.

댓글1

하늘구장님의 댓글

하늘구장 2020.01.29 17:13

카카오TV를 사용치 않아서 문제가 있었다는 것조차 몰랐었네요 요긴하게 패치해야겠네요 감사합니다

축하합니다. 첫 댓글로 9경험치를 획득하였습니다.