package com.zzsn.test;


import com.zzsn.extractor.ContentFileFinder;
import com.zzsn.extractor.ExtEntity;
import com.zzsn.extractor.FileTag;
import com.zzsn.extractor.WeiXinDispatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Map;

/**
 * mq客户端
 * 创建人：李东亮   
 * 创建时间：2016-4-6 上午9:51:06   
 * 公司 ：郑州数能软件科技有限公司
 * @version  1.0  
 *
 */
public class MqReceiver {
    private static final Logger Log = LoggerFactory.getLogger(MqReceiver.class);


   public static void main(String[] args) {
	
	   WeiXinDispatch wx=new WeiXinDispatch();
		ExtEntity extEntity=wx.getExtractorElement("https://mp.weixin.qq.com/s/-LE-dmgbTAWbzStiPUNynA");
		
		Map<String, FileTag> imgDataMap= ContentFileFinder.getContentFileTag(extEntity.getContentWithTag());
		System.out.println(extEntity.getContentWithTag());
		String formatImgContent=extEntity.getContentWithTag();
		 for (String key : imgDataMap.keySet()) {
			 FileTag fileTag = imgDataMap.get(key);
			 while (formatImgContent.contains(key)) {
	                //转换为绝对路径
				 System.out.println(key);
				 String key2=key.replace("data-src","src");
	                formatImgContent = formatImgContent.replace(key, key2);
	            }
		 }
		 System.out.println(formatImgContent);
}
    
  
    
    
}
