네이버 밴드 공유



function band_share(data) {

    var a_store='itms-apps://itunes.apple.com/app/id542613198?mt=8';

    var g_store='market://details?id=com.nhn.android.band';

    var a_proto='bandapp://';

    var g_proto='scheme=bandapp;package=com.nhn.android.band';

// 밴드 공유 내용

var param = 'create/post?text=' + data.content;

var method = 'popup';

var _data_url = encodeURIComponent(data.url);

var _data_content = encodeURIComponent(data.content);

// body뒤에 제목, 주소를 넣어야 메타이미지 나타남

window.open( "http://www.band.us/plugin/share?body=" + _data_content +encodeURIComponent("\n")+ _data_url +"&route=" + _data_url, "share_band", "width=410, height=540, resizable=no");

}

'Programming > SNS' 카테고리의 다른 글

[Facebook] 메타태그 크롤링  (0) 2016.10.27
메타태그를 공유할때 크롤링이 한번되어야 메타태그의 이미지를 불러올수 있다. 
페이스북에서 제공하는 디버그에 공유할 주소를 넣으면 메타태그에 대한 정보를 알수있다. https://developers.facebook.com/tools/debug/og/object/ 

하지만 동적인 URL을 일일이 할수 없으므로 페이스북에서 (그래프) 개체 업데이트를 제공한다. 

 api 주소
 https://graph.facebook.com/?id="해당 공유 id또는 공유 URL" &scrape=true 

 위의 주소로 POST방식으로 호출하면 된다. 
 JAVA 소스
private void facebookLinterURL(String share_url){
		String linterUrl = mapper.selectURL(share_url);
		String facebookDebugUrl = "https://graph.facebook.com/?id=";
		String facebookDebugUrlEnd = "&scrape=true";
		logger.debug("[facebookLinterURL] share_url : {}, absoluteURL : {}, fullURL : {}", 
				share_url, linterUrl, facebookDebugUrl + linterUrl + facebookDebugUrlEnd);
		URL url = null;
		HttpURLConnection connect = null;
		try {
			url = new URL(facebookDebugUrl + linterUrl + facebookDebugUrlEnd);
			connect = (HttpURLConnection) url.openConnection();
			connect.setDoInput(true);
			connect.setRequestMethod("POST");
			// 콜을해야 응답이 옴
			int response = connect.getResponseCode();
			System.out.println("[response] : " + response);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if(connect != null) connect.disconnect();
		} 
		
	}
만약 프로세스가 AWS S3에 올리고 공유결과를 DB에 저장하고 보여주는 프로세서라면
DB저장 후 Controller로 결과값을 보내기 전에 위의 소스를 한번실행시켜 
크롤링을 하면 메타데이터의 이미지를 공유창에서 볼수 있다.


'Programming > SNS' 카테고리의 다른 글

[BAND] 네이버 밴드 공유  (0) 2017.02.03

+ Recent posts