基於AutoJs實現的薅羊毛App專業版源碼大分享

源代碼和Apk地址鏈接:https://pan.baidu.com/s/1royu3pvZ0Z_KAlfqtLBBGw  密碼:yeph     

專業版肯定比個人版功能強大並且要穩定。增加了很多功能的同時也測試封號的App,對於封號的App,給予剔除。雖然App數量減少了但是都是穩定的且收益比較高的。並且一天也就刷那麼十幾個而已。專業版比較個人版增加了按照時間刷刷刷。同時每個app的時間可以設置,時間到達後自動進入下一個App。時間是一天之內的時間,也就是說一天之內不超過100分鐘,即使間斷執行程序也會按照設定時間執行。最後執行的時間就是100分鐘。

       專業版增加清理緩存的功能。每次看視頻結束後都會清理緩存。這樣保證手機內容小的的福音。同時也是對老手機防卡的一個操作。

       專業版增加自動評論功能,這個功能是最難的,操作很多且再輸入的時候經常出現錯誤,一般使用的輸入代碼是setText和Input。另外有的APP沒有評論功能。

       專業版簽到較之前個人版簽到做了個大改版,每個App的簽到都和App刷刷放到了一起。無論是簽到、自動清理緩存、自動答覆都使用了wateFor函數。(其實要慎用)

       專業版增加最實用的功能就是自動提現。目前提現的金額是最低額度。(接受定製)

       專業版修復了一些bug,同時也增加了一些功能。如:

  1. 修復了點贊和關注的BUG
  2. 增加了點贊和關注功能的概率(個人版是將代碼寫成了硬代碼)
  3. 自動評論也增加了概率

專業版最大的改動其實是代碼的優化。對代碼做了整體規劃也採用了中文名稱。這樣對對於閱讀和修改都是非常便利的。看下截圖:

 

薅羊毛專業版用到技術頗多。因爲打包成Apk肯定有和用戶交互的地方那也就意味着有UI界面。列舉一下技術有需要技術的也可以查看本文檔來複制代碼。

  1. AutoJs UI技術。List、button、checkbox、input、swich等控件。
  2. AutoJs UI技術複雜頁面佈局。抽屜、headermenu、tab頁面、垂直佈局、水平佈局等。
  3. Image圖標使用base64格式顯示。
  4. AutoJs 懸浮框。
  5. AutoJs 開啓無障礙權限代碼。
  6. AutoJs 開啓懸浮窗權限代碼。
  7. 多線程。
  8. Http訪問網絡。
  9. 控制檯。
  10. 本地存儲。
  11. 按鍵模擬。
  12. 事件與監聽。
  13. 對話框。
  14. 設備信息。
  15. App常用函數。

先不吹牛技術了,咱們直接看薅羊毛個人版APP的截圖。如下:

 

這個是寫的JS腳本在AutoJs裏面的效果。咱們看一看薅羊毛UI版的截圖。

 

薅羊毛首頁,Splash頁面。可以做很多東西……

薅羊毛配置頁面

前2項我就不多說了,友情提醒先開啓無障礙在開啓懸浮否則App會掛掉。

  1. 控制檯還是不建議開啓,有的App簽到會失敗。
  2. 是否開Toast提示,其實是無所謂的。
  3. 是否自動簽到,這個還是很意義的,之前我放自動刷的前面發現有的app會卡住,防止萬一我把簽到放到自動刷的後面了和清理內存一起
  4. 自動評論,在我看來整個app最難的就是這個,太難了…….另外不是所有的App都讓評論。
  5. 自動清理緩存,整個說過了。
  6. 自動提現,目前都是最小金額。
  7. 執行天數,大於1天就行反正我們手機少,如果是工作室多幾天還行不過別指望無障礙玩工作室那樣你會很崩潰,
  8. 滑動屏幕間隔,這個我默認是8秒。
  9. 隨機概率,默認是十分之一,該不該無所謂吧,主要是隨機點贊、隨機關注、隨機評論、隨機上滑、隨機下滑。控制着幾個事件的隨機概率。

薅羊毛專業版系統頁面:

  1. 日誌,我會將更新的日誌發到這裏
  2. 此版本將支持在線更新
  3. 教程還是我CSDN博客地址(以後會改)
  4. 關於就是版權說明,強調一下,我之前發佈的代碼有很多人轉載也沒寫版權我就不追究了,如果有人利用我的源碼和Apk文件在網絡上販賣我一定會追究。
  5. 退出……沒啥說的吧

接下來我把整個App比較難寫的地方寫貼出來給大家提個醒,可能你們認爲不是問題。獻醜了不要見笑。之後我會將所有代碼求全部貼出。

部局的時候出現了點問題,一直找不到合理的部局且很難看(現在也不怎麼好看)。後來在AutoJs中示例看到了複雜部局就學了一下,效果還可以吧。

 

代碼如下:

數據綁定代碼:

function initializeFirstFrame() {
    for (let i = 0; i < videoArray.length; i++) {
        let appName = videoArray[i];
        let signMessage = "未籤";
        let signValue = getSignTime(appName);
        let signColor = "#FF0000";
        if (getDate() == signValue) {
            signMessage = "已籤";
            signColor = "#228B22";
        }
        //今日薅羊毛時間 1440 1400 1605-20=1585-1440=145-60=85-20=65-60
        let execTimesMessage = "";
        let key = appName + storageSign + getDate();
        let havedRunTimes = woolStorage.get("" + key + "");
        if (havedRunTimes == null) {
            execTimesMessage = ("已刷:0分");
        } else {
            if (parseInt(havedRunTimes) < 1000 * 60) {
                execTimesMessage = ("已刷時間小於1分鐘");
            }
            let havedMinute = (havedRunTimes / 1000) / 60;//讀取到的時間是毫秒需要轉換成秒,轉換成秒後在轉換成分鐘
            execTimesMessage = ("已刷:" + havedMinute.toFixed(2) + "分");
        }
        if (appName == "微視") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "65", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "抖音極速版") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "30", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "快手極速版") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "180", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "火山極速版") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "120", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "閃電盒子極速版") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "50", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "歡樂盒子") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "50", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "火火視頻極速版") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "120", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "刷寶短視頻") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "60", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "彩蛋視頻") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "120", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "快音") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "120", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "中青看點") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "100", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "趣鈴聲") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "120", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "愛走路") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "120", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "閃鴨短視頻") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "60", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else if (appName == "長豆短視頻") {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "80", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        } else {
            let row = { SignColor: signColor, AppName: videoArray[i], AppIndex: (i + 1), ExecTimes: "15", IsSign: signMessage, done: false, ExecTimesMessage: execTimesMessage };
            videoItems.push(row);
        }
    }
    ui.videoList.setDataSource(videoItems);
    //小視頻綁定check事件 火火視頻極速版 長豆短視頻 
    ui.videoList.on("item_bind", function (itemView, itemHolder) {
        itemView.done.on("check", function (checked) {
            let item = itemHolder.item;
            item.done = checked;
            let appName = item.AppName;
            let appIndex = itemView.appIndex.getText();
            item.AppIndex = appIndex;

            item.ExecTimes = itemView.execTimes.getText();
            let brushTimes = itemView.execTimes.getText();
            if (checked) {
                havedVideoChecked.put(appName, appIndex);
                havedVideoTimes.put(appName, brushTimes);
            } else {
                havedVideoChecked.remove(appName);
                havedVideoTimes.remove(appName);
            }
        });
    });
    ui.videoList.on("item_click", function (item, i, itemView, listView) {
        itemView.done.checked = !itemView.done.checked;
    });
}

 

保存配置採用的是storage,這個是不安全的只要知道名稱就可以訪問,敏感數據不建議使用它。保存配置代碼:

    ui.btnSaveWoolConfig.click(function () {
        woolStorage.put("isShowConsole", "" + ui.switchIsShowConsole.isChecked() + "");
        woolStorage.put("timesInterval", "" + ui.txtScreenSileTimesInterval.getText() + "");
        woolStorage.put("IsAutoSign", "" + ui.switchIsAutoSign.isChecked() + "");
        woolStorage.put("IsClearCache", "" + ui.switchIsClearCache.isChecked() + "");
        woolStorage.put("IsCashOut", "" + ui.switchIsCashOut.isChecked() + "");
        woolStorage.put("IsAutoComment", "" + ui.switchIsAutoComment.isChecked() + "");
        woolStorage.put("IsShowToast", "" + ui.switchIsShowToast.isChecked() + "");
        woolStorage.put("ForeachDays", "" + ui.txtForeachDays.getText() + "");
        //txtForeachDays
        toast("薅羊毛專業版配置保存成功!");
    });

具體業務代碼在我之前的文章裏面已經寫過了,我現在把完整代碼貼一下,服務器信息是我的大家別亂搞就好了哈。

 

附贈Apk地址鏈接:https://pan.baidu.com/s/1royu3pvZ0Z_KAlfqtLBBGw  密碼:yeph

最後再次強調:我提供的是源代碼,Apk是附屬產品。源碼和Apk的用途本人概不負責。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章