架构师_程序员_码农网

Retrieve password
Register

QQ登录

Just one step to get started

Search
架构师_程序员_码农网 " 架构师 ' 管理专区&Management Area ' Complaints and Suggestions ' 回收站 ' 爱奇艺 播放器之去广告分析
View:5980|Reply: 3
打印 上一主题 下一主题

The Aiki player to go to the ads to analyze

[copy link]
跳转到指定楼层
the owner of the building
发表于 2014-10-23 22:26:53| 看该作者回帖奖励|Browse in reverse order|Read mode

Recently busy with the opening of the school suitable for blind folding - these two days Zero busy video ads, said the ads are getting more and more flooded, some of the video opening ads are more than 60s. He got rid of the ads for Sohu, but he hasn't been able to get rid of the ads for Aqiyi. Let me help him look.

The source code is what he gave me, I don't have a swf decompiler.

I didn't have a swf decompiler. I probably looked at the structure, and I haven't learned ActionScript. He said it's similar to Java, so I don't bother to look at the basic syntax, and go straight to it. First, let's look at the header of the main file Player.as to see what references are there.

  1.     import com.iqiyi.components.global.*;
  2.     import com.iqiyi.components.tooltip.*;
  3.     import com.qiyi.player.base.pub.*;
  4.     import com.qiyi.player.base.uuid.*;
  5.     import com.qiyi.player.core.*;
  6.     import com.qiyi.player.core.model.def.*;
  7.     import com.qiyi.player.core.model.utils.*;
  8.     import com.qiyi.player.wonder.*;
  9.     import com.qiyi.player.wonder.body.view.*;
  10.     import com.qiyi.player.wonder.common.config.*;
  11.     import com.qiyi.player.wonder.common.lso.*;
  12.     import com.qiyi.player.wonder.common.pingback.*;
  13.     import com.qiyi.player.wonder.common.sw.*;
  14.     import flash.display.*;
  15.     import flash.events.*;
  16.     import flash.media.*;
  17.     import flash.system.*;
  18.     import flash.utils.*;
Copy the code

Look at the name, com.qiyi.player.wonder.common.config.*; caught my attention - look at the configuration information. There are two files, FlashVarConfig.as and SystemConfig.as. SystemConfig.as doesn't show anything interesting, but the xml configuration file referenced in FlashVarConfig.as is worth investigating.

  1. package com.qiyi.player.wonder.common.config
  2. {

  3.     public class FlashVarConfig extends Object
  4.     {
  5.         public static const OWNER_PAGE:String = "page";
  6.         public static const OWNER_CLIENT:String = "client";
  7.         public static const OS_XP:String = "xp";
  8.         public static const OS_WIN7:String = "win7";
  9.         public static const OS_WIN8:String = "win8";
  10.         public static const PAGE_OPEN_SRC_NONE:String = "0";
  11.         public static const PAGE_OPEN_SRC_DIRECT:String = "1";
  12.         public static const PAGE_OPEN_SRC_OTHER:String = "2";
  13.         private static var _flashVarSource:Object;
  14.         private static var _albumId:String = "";
  15.         private static var _tvid:String = "0";
  16.         private static var _vid:String = "";
  17.         private static var _autoPlay:Boolean = true;
  18.         private static var _isMemberMovie:Boolean = false;
  19.         private static var _cyclePlay:Boolean = false;
  20.         private static var _components:String = "fefff7e6";
  21.         private static var _cupId:String = "";
  22.         private static var _shareStartTime:int = -1;
  23.         private static var _shareEndTime:int = -1;
  24.         private static var _preloaderURL:String = "http://dispatcher.video.qiyi.com/dispn/player/preloader.swf";
  25.         private static var _preloaderVipURL:String = "";
  26.         private static var _exclusivePreloader:String = "";
  27.         private static var _useGPU:Boolean = true;
  28.         private static var _showBrand:Boolean = true;
  29.         private static var _expandState:Boolean = false;
  30.         private static var _tipDataURL:String = "http://static.qiyi.com/ext/tips/tipdata.xml";
  31.         private static var _coop:String = "";
  32.         private static var _owner:String = "page";
  33.         private static var _os:String = "win7";
  34.         private static var _adPlayerURL:String = "";
  35.         private static var _origin:String = "";
  36.         private static var _passportID:String = "";
  37.         private static var _playListID:String = "";
Copying the code

On line 31, this config file has this paragraph. And in line 35 of the advertisement address also caught my attention, later in the analysis. First look at the configuration file.

  1. </item>
  2. <!-- 正在为您播放片中广告, 可选择是否要跳过, 类别是1, 持续时间是8秒 -->
  3. <!-- 限制条件是:  不是正在登录中的会员 -->
  4. <!-- 每天每人次只最多显示两次这个tips -->
  5. <item id="ToSelectWhetherToSkipPlayingMiddleAD" level="1" duration="-1" type="1">
  6. <conditions>
  7. <fields>
  8. <field name="member" operator="eq" value="false"/>
  9. </fields>
  10. <frequency count="2">
  11. <restrain name="day"/>
  12. <restrain name="user"/>
  13. </frequency>
  14. </conditions>
  15. <list>
  16. <message>
  17. <![CDATA[
  18. 正在为您播放片中广告, <a href="event:ASEvent(skipAD)"><b><u>跳过广告</u></b></a>
  19. ]]>
  20. </message>
  21. </list>
  22. </item>
  23. <!-- 提示即将跳过8秒后会显示的剧中广告, 类别是1, 持续时间是8秒 -->
  24. <!-- 必须是登录的会员 -->
  25. <item id="ToCancelSkipNextMiddleAD" level="1" duration="8" type="1">
  26. <conditions>
  27. <fields>
  28. <field name="member" operator="eq" value="true"/>
  29. </fields>
  30. <frequency count="1">
  31. <restrain name="day"/>
  32. <restrain name="user"/>
  33. </frequency>
  34. </conditions>
  35. <list>
  36. <message>
  37. <![CDATA[
  38. 即将为您跳过片中广告,<a href="event:ASEvent(cancelSkipAD)"><u>不再跳过</u></a>
  39. ]]>
  40. </message>
  41. </list>
  42. </item>
  43. <!--
  44. 提示版权下线, 如果还有小于7天的时间下线, 每天一个专辑一台电脑提醒一次, 类别是1, 从起始60秒开始显示, 持续时间是10秒
  45. -->
  46. <!-- 因为优先级很高, 前面的最高优先级是10, 所以这里把level设为11. -->
  47. <!-- 这个tip是由signal发起的. Shawn.X  -->
  48. <!--
  49. 《<span>#keyword#</span>》 将于  <span>#expiredTime#</span> 版权到期.
  50. -->
  51. <item id="NoticeThisCopyrightWillExpire" level="11" duration="10" type="1">
  52. <conditions>
Copy the code

It says it's an in-show ad, 8s time, which means I localized it and hijacked the browser to remove the ads, but it's clear that this isn't an ad before the video loads. Keep flipping-very boring process.

Find out who calls get adPlayerURL() and look upwards. Under com\qiyi\player\wonder\plugins\ad, I found that the ad player exists in the form of a plugin, that is, there is still a call to it, looking upwards, I found that at com\qiyi\cupid\adplayer\CupidAdPlayer.as CupidAdPlayer is initialized. And the class is obfuscated, which is suspicious.

  1. public function CupidAdPlayer(param1:CupidParam)
  2.         {
  3.             this.PLAYER_TIMEOUT_LENGTHS = new Array(10000, 15000);
  4.             Log.info("init, version=" + VERSION + ", " + param1.toString());
  5.             this._videoPlayerVersion = param1.videoPlayerVersion;
  6.             this._videoId = param1.videoId;
  7.             this._tvId = param1.tvId;
  8.             this._channelId = param1.channelId;
  9.             this._collectionId = param1.collectionId;
  10.             this._playerId = param1.playerId;
  11.             this._albumId = param1.albumId;
  12.             this._userId = param1.userId;
  13.             this._webEventId = param1.webEventId;
  14.             this._videoEventId = param1.videoEventId;
  15.             this._vipRight = param1.vipRight;
  16.             this._terminal = param1.terminal;
  17.             this._duration = param1.duration;
  18.             this._passportId = param1.passportId;
  19.             this._passportCookie = param1.passportCookie;
  20.             this._passportKey = param1.passportKey;
  21.             this._videoDefinitionId = param1.videoDefinitionId;
  22.             if (this.isQiyiWebEx())
  23.             {
  24.                 this._playerUrl = this.IQIYI_WEBEX_AM_URL;
  25.             }
  26.             else if (param1.playerUrl)
  27.             {
  28.                 this._playerUrl = param1.playerUrl;
  29.             }
  30.             else
  31.             {
  32.                 this._playerUrl = this.IQIYI_WEB_AM_URL;
  33.             }
  34.             if (param1.dispatcher == null)
  35.             {
  36.                 this._dispatcher = this;
  37.             }
  38.             else
  39.             {
  40.                 this._dispatcher = param1.dispatcher;
  41.             }
  42.             this._volume = param1.volume;
  43.             this._videoIndex = param1.videoIndex;
  44.             this._stageWidth = param1.stageWidth;
  45.             this._stageHeight = param1.stageHeight;
  46.             this._displayContainer = param1.adContainer;
  47.             this._screenStatus = DisplayProperties.isFullScreen(this._displayContainer.stage) ? ("1") : ("0");
  48.             this._baiduMainVideo = param1.baiduMainVideo;
  49.             this._disablePreroll = param1.disablePreroll;
  50.             this._disableSkipAd = param1.disableSkipAd;
  51.             this._enableVideoCore = param1.enableVideoCore;
  52.             this._isUGC = param1.isUGC;
  53.             this._videoPlayerUrl = this._displayContainer.loaderInfo ? (this._displayContainer.loaderInfo.loaderURL) : ("");
  54.             this._env = this.generateEnv();
  55.             this.addAdPlayerEventListeners();
  56.             return;
  57.         }// end function
Copy the code

CupidAdPlayer(param1:CupidParam) <- look at its calling parameters, that is, the upper layer is still calling, which parameter one, a value is very noticeable, vipRight Judge whether it is vip, and vip does not exist ads, that is to say, if I get the user information in the session in the player, I will use it to initialize CupidAdPlayer.as. That is to say, if I make a change in the place of judging whether a user is a vip after the player gets the user's information from the website's session, it will lead to the lower level being mistakenly thought to be a vip when it's called (only the advertisement player will think that you're a vip, while the rest of the place will not be affected). So let's keep looking upwards. We're looking for it, and we're going back to the directory of the ad plugin. com\qiyi\player\wonder\plugins\ad\view in ADView.as, with the header first being

  1. private var _adPlayer:CupidAdPlayer;
Copy Code

Defined an instance of CupidAdPlayer named _adPlayer once, scrolled down to find out who uses _adPlayer. surprisingly found the ad player creation function.

  1. public function createAdPlayer(param1:CupidParam) : void
  2.         {
  3.             if (this._adPlayer)
  4.             {
  5.                 this.unloadAdPlayer();
  6.             }
  7.             this._log.info("loading adplayer...");
  8.             this._adPlayer = new CupidAdPlayer(param1);
  9.             this._adPlayer.addEventListener(AdPlayerEvent.ADPLAYER_LOADING_SUCCESS, this.onAdLoadSuccess);
  10.             this._adPlayer.addEventListener(AdPlayerEvent.ADPLAYER_LOADING_FAILURE, this.onAdLoadFailed);
  11.             this._adPlayer.addEventListener(AdPlayerEvent.ADPLAYER_AD_START, this.onAdStartPlay);
  12.             this._adPlayer.addEventListener(AdPlayerEvent.CONTROL_VIDEO_PAUSE, this.onAdAskVideoPause);
  13.             this._adPlayer.addEventListener(AdPlayerEvent.CONTROL_VIDEO_RESUME, this.onAdAskVideoResume);
  14.             this._adPlayer.addEventListener(AdPlayerEvent.CONTROL_VIDEO_START_LOADING, this.onAdAskVideoStartLoad);
  15.             this._adPlayer.addEventListener(AdPlayerEvent.CONTROL_VIDEO_START, this.onAdAskVideoStartPlay);
  16.             this._adPlayer.addEventListener(AdPlayerEvent.CONTROL_VIDEO_END, this.onAdAskVideoEnd);
  17.             this._adPlayer.addEventListener(AdPlayerEvent.ADPLAYER_AD_BLOCK, this.onAdBlock);
  18.             this._adPlayer.addEventListener(AdPlayerEvent.CONTROL_VIDEO_DISPLAY_AD_TIP, this.onAskVideoShowBonusTips);
  19.             this._adPlayer.addEventListener(AdPlayerEvent.ADPLAYER_AD_VIDEO, this.onAdFlvADAction);
  20.             this._adPlayer.load();
  21.             return;
  22.         }// end function
Copying the code

Seeing that you can still pass parameters means that it's still being called. I finally found the source in ADViewMediator.as under com\qiyi\player\wonder\plugins\ad\view. The final call to his function looks like this

  1. private function createADPlayer() : void
  2.         {
  3.             sendNotification(BodyDef.NOTIFIC_PLAYER_STOP_LOAD);
  4.             ProcessesTimeRecord.STime_adInit = getTimer();
  5.             var _loc_1:* = facade.retrieveProxy(PlayerProxy.NAME) as PlayerProxy;
  6.             var _loc_2:* = facade.retrieveProxy(UserProxy.NAME) as UserProxy;
  7.             var _loc_3:* = new CupidParam();
  8.             _loc_3.playerUrl = FlashVarConfig.adPlayerURL;
  9.             _loc_3.videoId = _loc_1.curActor.loadMovieParams.vid;
  10.             _loc_3.tvId = _loc_1.curActor.loadMovieParams.tvid;
  11.             _loc_3.channelId = _loc_1.curActor.movieModel.channelID;
  12.             _loc_3.playerId = FlashVarConfig.cupId;
  13.             _loc_3.albumId = _loc_1.curActor.movieModel.albumId;
  14.             _loc_3.dispatcher = null;
  15.             _loc_3.adContainer = this._ADView;
  16.             _loc_3.stageWidth = GlobalStage.stage.stageWidth;
  17.             _loc_3.stageHeight = GlobalStage.stage.stageHeight;
  18.             _loc_3.userId = _loc_1.curActor.uuid;
  19.             _loc_3.webEventId = UUIDManager.instance.getWebEventID();
  20.             _loc_3.videoEventId = UUIDManager.instance.getVideoEventID();
  21.             _loc_3.vipRight = _loc_2.userLevel != UserDef.USER_LEVEL_NORMAL ? ("1") : ("0");
  22.             _loc_3.terminal = "iqiyiw";
  23.             _loc_3.duration = _loc_1.curActor.movieModel.duration / 1000;
  24.             _loc_3.passportId = _loc_2.passportID;
  25.             _loc_3.passportCookie = _loc_2.P00001;
  26.             _loc_3.passportKey = KeyUtils.getPassportKey(0);
  27.             _loc_3.enableVideoCore = true;
  28.             _loc_3.disableSkipAd = _loc_1.curActor.movieModel.forceAD;
  29.             _loc_3.volume = Settings.instance.mute ? (0) : (Settings.instance.volumn);
  30.             _loc_3.isUGC = UGCUtils.isUGC(_loc_1.curActor.movieModel.tvid);
  31.             _loc_3.collectionId = FlashVarConfig.collectionID;
  32.             _loc_3.videoDefinitionId = _loc_1.curActor.movieModel.curDefinitionInfo.type.id;
  33.             _loc_3.videoPlayerVersion = WonderVersion.VERSION_WONDER;
  34.             this._ADView.createAdPlayer(_loc_3);
  35.             return;
  36.         }// end function
Copy Code

The key point is in the

  1. _loc_3.vipRight = _loc_2.userLevel != UserDef.USER_LEVEL_NORMAL ? ("1") : ("0");
Copy Code

This line, to determine whether the user is a vip or not, first according to the local variable loc_2 to determine the user's level, if with the definition of the vip level matches, it will return 1. We give him a slight modification, it will become a pseudo-vip.

  1. _loc_3.vipRight = _loc_2.userLevel != UserDef.USER_LEVEL_NORMAL ? ("1") : ("1");
Copy the code

This in Hex to modify the line, test ads successfully removed (using Chrome's plug-in function, modify the player address for the local, the playback parameters are passed as is).

In addition, in the AdBlockedBlackScreen.as under com\qiyi\cupid\adplayer\model, there is a local detection function to prohibit Chrome's plug-in blocking.

  1. public static function isInBlacklist(param1:String) : Boolean
  2.         {
  3.             if (!param1)
  4.             {
  5.                 return false;
  6.             }
  7.             if (StringUtils.beginsWith(param1, "chrome-extension://"))
  8.             {
  9.                 return true;
  10.             }
  11.             var _loc_2:* = new URLParser(param1);
  12.             var _loc_3:* = _loc_2.getHost();
  13.             return HOST_BLACKLIST.indexOf(_loc_3) != -1;
  14.         }// end function
Copy the code

Just change the return of the second if to false.






Previous articleFreeze Restore Wizard 7.5 alternative crack in Win7
Next: VMware virtual machine installation MAC OSX Mountain Lion
Code farmer network, only published in the practice process, encountered technical difficulties, not mislead others.
I 'm not sure if I'll be able to do that.
I 'm not sure if I'm going to be able to do that.
Posted on 2014-10-23 23:25:57|Only View Author
Xiao Ningzi is so awesome
The code farmer network, only published in the process of practice, encountered technical difficulties, do not mislead others.
Bench
发表于 2014-10-24 21:57:25| 看该作者
This plugin for blocking ads is not bad

Rating

Participants 1 MB +1 Contribution +1 Put awayReason
admin + 1 + 1 Very powerful!

View all ratings

The code farmer network, only published in the process of practice, encountered technical difficulties, do not mislead others.
jordan shoes for sale online
floorboards
owner|发表于 2014-10-24 22:01:44| 看该作者
Posted by skywriter on 2014-10-24 21:57
This adblocking plugin is not bad

Adblock Plus is the most popular ad filtering software available for Firefox, Chrome, Opera, Safari, Android and Internet Explorer browsers. Filter all annoying online ads: remove video ads on Youtube, filter Facebook ads, get rid of pop-up ads and many more. On Google Chrome, Adblock Plus is one of the fastest growing plugins.
Coder.com, only published in the process of practice, encountered technical difficulties, do not mislead others.
You need to log in before you can post back Log in | Register

This version of the integral rules

DISCLAIMER:
All software, programming materials or articles published by Code Farmer are limited to be used for learning and research purposes only; the above content shall not be used for commercial or illegal purposes, otherwise, all the consequences should be borne by the user. This site information from the network, copyright dispute has nothing to do with this site. You must completely remove the above content from your computer within 24 hours of downloading. If you like the program, please support the genuine software, buy registration and get better genuine service. If there is any infringement, please contact us by email to deal with it.

Mail To:help@itsvse.com

QQ| ( ICP备14021824号-2 )|Sitemap

GMT+8, 2024-9-17 14:05

Quick ReplyBack to topBack to list