[이윰] 네이버TV 올바르게 적용하기

페이지 정보

shadow2fox shadow2fox 2,513 5 2 2019.10.12 20:13:11

평점

  • 평점 : 5점 (2명 참여)

본문

네이버TV 올바르게 적용하기
네이버 TV가 변경되어 현재 이윰빌더 4.x에서도 올바르게 보여지지 않는다.

그누보드5/eyoom/classes/eyoom.class.php를 열어 동영상 key 추출하기를 검색하여 아래와 같이 수정한다.

수정 전

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

            case 'tvcast.naver.com':
            case 'tv.naver.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 'tvcast.naver.com':
            case 'tv.naver.com':
                preg_match('/&outKey=(?P<outKey>[a-zA-Z0-9]+)&/i', $output, $scrapping);
                $out['outKey']= $scrapping['outKey'];
                preg_match('/\?vid=(?P<vid>[a-zA-Z0-9]+)&/i', $output, $scrapping);
                $out['vid']= $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 'tvcast.naver.com':
            case 'tv.naver.com':
                preg_match('/\<meta property=\"og:video: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 'tvcast.naver.com':
            case 'tv.naver.com':
                $source = '<iframe width="'.$video['width'].'" height="'.$video['height'].'" src="http://serviceapi.rmcnmv.naver.com/flash/outKeyPlayer.nhn?vid='.$video['key1'].'&outKey='.$video['key2'].'&controlBarMovable=true&jsCallable=true&skinName=tvcast_black" frameborder="no" scrolling="no" marginwidth="0" marginheight="0"></iframe>';
                break;
수정 후

            case 'tvcast.naver.com':
            case 'tv.naver.com':                
                if ($video['key1'] != null) {
                    $source = '<iframe width="'.$video['width'].'" height="'.$video['height'].'" src="https://tv.naver.com/embed/'.$video['key1'].'?autoPlay=true" frameborder="no" scrolling="no" marginwidth="0" marginheight="0" allowfullscreen></iframe>';
                } else {
                    $source ='<p style="display:table;margin:30px auto 0;text-align:center;padding:5px;border-top:1px dotted #eee;border-bottom:1px dotted #eee;line-height:1.6;font-size:14px;color:rgb(180, 180, 180);max-width:100%;background-color:transparent;">⏳ 삭제되었거나 네이버 제공이 중지된 동영상입니다.</p>';
                }
                break;
?autoPlay=true옵션은 자동 재생과 연관된 옵션이기에 입맛에 맞게 넣거나 뺀다.

$source = "<div class='responsive-video'>".$source."</div>";를 검색하여 아래와 같이 수정한다.

수정 전

            $source = "<div class='responsive-video'>".$source."</div>";
수정 후

            if ($video['key1'] != null) $source = "<div class='responsive-video'>".$source."</div>";
추천인 2
  • 012i1052u
    내사랑
  • skyfield4u
    하늘구장
shadow2fox
10
shadow2fox - 회원등급 : 자연/Level 147 - 포인트 : 2,607,149
레벨 147
경험치 3,225,027

Progress Bar 12.99%

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

댓글5

랩퍼투혼님의 댓글

랩퍼투혼 2022.10.28 20:04
좋은 기능이 많은 이곳을 회원님들은 활발하게 이용해야합니다 ㅋ 유튜브 https://www.youtube.com 비메오 https://vimeo.com 네이버 TV https://tv.naver.com 카카오 TV https://tv.kakao.com 테드 https://www.ted.com 데일리모션 https://www.dailymotion.com 슬라이더쉐어 https://www.slideshare.net 유쿠 https://www.youku.com iQiyi https://www.iqiyi.com 동영상도 바로 올릴 수 있는거 같아요!

하늘구장님의 댓글

skyfield4u
하늘구장 2019.10.13 11:47
아앗~ 감사합니다 간간히 네이버 TV를 사용해야 했지만 반포기 상태였는데 영자님 최고!! 페이스북 동영상도 좀 해결해 주시면

shadow2fox님의 댓글

1/26
shadow2fox
shadow2fox 글쓴이 @하늘구장 2019.10.13 14:11
내일 즈음에 페이스북 동영상에 관한 수정 소스를 올려 놓겠습니다

하늘구장님의 댓글

2/26
skyfield4u
하늘구장 @shadow2fox 2019.10.13 14:12
미리 감사합니다

내사랑님의 댓글

012i1052u
내사랑 2019.10.12 20:31
네이버 TV를 이용해 본 적이 없어서 안되는 줄도 몰랐네요 잘 적용하겠습니다 땡큐요

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

Total 7591038 페이지
제목 글쓴이 날짜 조회 추천
그누•영카트  댓글+1🏆 그누보드 5.4.1.3 shadow2fox 2019.12.24 2,189 1
그누•영카트  🏆 인기검색어 등록 특정 단어 제외시키기 shadow2fox 2019.12.17 2,202 0
이윰  댓글+5🏆 출석부 랭킹 중복 방지하기 shadow2fox 2019.12.16 3,292 4
그누•영카트  🏆 영카트 5.4.1.2 shadow2fox 2019.12.10 2,373 0
그누•영카트  🏆 영카트 5.4.1.1.1 shadow2fox 2019.12.10 1,917 0
그누•영카트  🏆 그누보드 5.4.1.2 shadow2fox 2019.12.10 1,904 0
그누•영카트  🏆 영카트 5.4.1.1 shadow2fox 2019.12.03 1,972 0
그누•영카트  🏆 그누보드 5.4.1.1 shadow2fox 2019.12.03 2,152 0
그누•영카트  🏆 📸 5.3.3.3 버전 에서 5.4.1 정식버전으로 패치 shadow2fox 2019.12.03 1,889 0
그누•영카트  댓글+4🏆 📸 5.3.3.3 버전 에서 5.4.1 정식버전으로 패치 shadow2fox 2019.12.03 2,409 2
이윰  댓글+3🏆 페이스북(facebook) 동영상 올바르게 적용하기 shadow2fox 2019.10.14 2,536 2
이윰  댓글+5🏆 🚩 네이버TV 올바르게 적용하기 shadow2fox 2019.10.12 2,514 2
그누•영카트  🏆 영카트 5.3.3.3.1 shadow2fox 2019.10.05 2,141 0
에디터  🏆 [CKEDITOR] Error code: filetools-response-error 해결하기 shadow2fox 2019.09.19 3,231 0
그누•영카트  🏆 영카트 5.3.3.3 shadow2fox 2019.09.17 2,092 0
그누•영카트  🏆 그누보드 5.3.3.3 shadow2fox 2019.09.17 2,059 0
에디터  🏆 [CKEDITOR] Error code: editor-element-conflict 해결하기 shadow2fox 2019.08.27 4,447 0
그누•영카트  🏆 영카트 5.3.3.2 shadow2fox 2019.08.13 2,235 0
그누•영카트  🏆 그누보드 5.3.3.2 shadow2fox 2019.08.13 2,402 0
이윰  댓글+3🏆 출석체크 점수 경험치로 부여하기 루루아빠 2019.08.11 2,834 2