1.根据关键字采集百度搜寻结果
根据关键字采集百度搜寻结果,可以使用curl实现,代码如下:
<"text-align: center">![]()
2.采集后的图片不显示原因分析
直接在百度中搜寻,页面是可以显示图片的。使用firebug查看图片路径,发现采集的图片域名与在百度搜寻的图片域名不同。
采集返回的图片域名 t11.baidu.com
正常搜寻的图片域名 ss1.baidu.com
查看采集与正常搜寻的html,发现有个域名转换的js是不一样的
采集
var list = { "graph.baidu.com": "http://graph.baidu.com", "t1.baidu.com":"http://t1.baidu.com", "t2.baidu.com":"http://t2.baidu.com", "t3.baidu.com":"http://t3.baidu.com", "t10.baidu.com":"http://t10.baidu.com", "t11.baidu.com":"http://t11.baidu.com", "t12.baidu.com":"http://t12.baidu.com", "i7.baidu.com":"http://i7.baidu.com", "i8.baidu.com":"http://i8.baidu.com", "i9.baidu.com":"http://i9.baidu.com", };正常搜寻
var list = { "graph.baidu.com": "https://sp0.baidu.com/-aYHfD0a2gU2pMbgoY3K", "t1.baidu.com":"https://ss0.baidu.com/6ON1bjeh1BF3odCf", "t2.baidu.com":"https://ss1.baidu.com/6OZ1bjeh1BF3odCf", "t3.baidu.com":"https://ss2.baidu.com/6OV1bjeh1BF3odCf", "t10.baidu.com":"https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq", "t11.baidu.com":"https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq", "t12.baidu.com":"https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq", "i7.baidu.com":"https://ss0.baidu.com/73F1bjeh1BF3odCf", "i8.baidu.com":"https://ss0.baidu.com/73x1bjeh1BF3odCf", "i9.baidu.com":"https://ss0.baidu.com/73t1bjeh1BF3odCf", };因此可以断定是,百度根据来源地址、IP、header等参数,判断如果是采集的,则返回不同的js。
3.采集后图片不显示的解决方法
把采集到的html,根据定义的域名做一次批量转换即可。
<"http://graph.baidu.com": "https://sp0.baidu.com/-aYHfD0a2gU2pMbgoY3K", "http://p.qiao.baidu.com":"https://sp0.baidu.com/5PoXdTebKgQFm2e88IuM_a", "http://vse.baidu.com":"https://sp3.baidu.com/6qUDsjip0QIZ8tyhnq", "http://hdpreload.baidu.com":"https://sp3.baidu.com/7LAWfjuc_wUI8t7jm9iCKT-xh_", "http://lcr.open.baidu.com":"https://sp2.baidu.com/8LUYsjW91Qh3otqbppnN2DJv", "http://kankan.baidu.com":"https://sp3.baidu.com/7bM1dzeaKgQFm2e88IuM_a", "http://xapp.baidu.com":"https://sp2.baidu.com/yLMWfHSm2Q5IlBGlnYG", "http://dr.dh.baidu.com":"https://sp0.baidu.com/-KZ1aD0a2gU2pMbgoY3K", "http://xiaodu.baidu.com":"https://sp0.baidu.com/yLsHczq6KgQFm2e88IuM_a", "http://sensearch.baidu.com":"https://sp1.baidu.com/5b11fzupBgM18t7jm9iCKT-xh_", "http://s1.bdstatic.com":"https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K", "http://olime.baidu.com":"https://sp0.baidu.com/8bg4cTva2gU2pMbgoY3K", "http://app.baidu.com":"https://sp2.baidu.com/9_QWsjip0QIZ8tyhnq", "http://i.baidu.com":"https://sp0.baidu.com/74oIbT3kAMgDnd_", "http://c.baidu.com":"https://sp0.baidu.com/9foIbT3kAMgDnd_", "http://sclick.baidu.com":"https://sp0.baidu.com/5bU_dTmfKgQFm2e88IuM_a", "http://nsclick.baidu.com":"https://sp1.baidu.com/8qUJcD3n0sgCo2Kml5_Y_D3", "http://sestat.baidu.com":"https://sp1.baidu.com/5b1ZeDe5KgQFm2e88IuM_a", "http://eclick.baidu.com":"https://sp3.baidu.com/-0U_dTmfKgQFm2e88IuM_a", "http://api.map.baidu.com":"https://sp2.baidu.com/9_Q4sjOpB1gCo2Kml5_Y_D3", "http://ecma.bdimg.com":"https://ss1.bdstatic.com/-0U0bXSm1A5BphGlnYG", "http://ecmb.bdimg.com":"https://ss0.bdstatic.com/-0U0bnSm1A5BphGlnYG", "http://t1.baidu.com":"https://ss0.baidu.com/6ON1bjeh1BF3odCf", "http://t2.baidu.com":"https://ss1.baidu.com/6OZ1bjeh1BF3odCf", "http://t3.baidu.com":"https://ss2.baidu.com/6OV1bjeh1BF3odCf", "http://t10.baidu.com":"https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq", "http://t11.baidu.com":"https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq", "http://t12.baidu.com":"https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq", "http://i7.baidu.com":"https://ss0.baidu.com/73F1bjeh1BF3odCf", "http://i8.baidu.com":"https://ss0.baidu.com/73x1bjeh1BF3odCf", "http://i9.baidu.com":"https://ss0.baidu.com/73t1bjeh1BF3odCf", "http://b1.bdstatic.com":"https://ss0.bdstatic.com/9uN1bjq8AAUYm2zgoY3K", "http://ss.bdimg.com":"https://ss1.bdstatic.com/5aV1bjqh_Q23odCf", "http://opendata.baidu.com":"https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv", "http://api.open.baidu.com":"https://sp0.baidu.com/9_Q4sjW91Qh3otqbppnN2DJv", "http://tag.baidu.com":"https://sp1.baidu.com/6LMFsjip0QIZ8tyhnq", "http://f3.baidu.com":"https://sp2.baidu.com/-uV1bjeh1BF3odCf", "http://s.share.baidu.com":"https://sp0.baidu.com/5foZdDe71MgCo2Kml5_Y_D3", "http://bdimg.share.baidu.com":"https://ss1.baidu.com/9rA4cT8aBw9FktbgoI7O1ygwehsv", "http://1.su.bdimg.com":"https://ss0.bdstatic.com/k4oZeXSm1A5BphGlnYG", "http://2.su.bdimg.com":"https://ss1.bdstatic.com/kvoZeXSm1A5BphGlnYG", "http://3.su.bdimg.com":"https://ss2.bdstatic.com/kfoZeXSm1A5BphGlnYG", "http://4.su.bdimg.com":"https://ss3.bdstatic.com/lPoZeXSm1A5BphGlnYG", "http://5.su.bdimg.com":"https://ss0.bdstatic.com/l4oZeXSm1A5BphGlnYG", "http://6.su.bdimg.com":"https://ss1.bdstatic.com/lvoZeXSm1A5BphGlnYG", "http://7.su.bdimg.com":"https://ss2.bdstatic.com/lfoZeXSm1A5BphGlnYG", "http://8.su.bdimg.com":"https://ss3.bdstatic.com/iPoZeXSm1A5BphGlnYG" }'; $domain = json_decode($baidu_domain, true); foreach($domain as $k=>$v){ $str = str_replace($k, $v, $str); } return $str; } $wd = '仙剑奇侠传'; $url = 'http://www.baidu.com/s"text-align: center">![]()
以上所述是小编给大家介绍的PHP CURL采集百度搜寻结果图片不显示问题的解决方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
php,采集百度图片不显示问题
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。