WeChat Moments Automatic Likes (Python Code Implementation)

content

1 person a pair, shadow a pair

2 Is our perception a vacuum channel?

2.1 Vision

2.2 Hearing

3 WeChat Moments Automatic Likes (Python code implementation) 

3.1 Like it

3.2 Knowledge Reserve

3.3 Python code


1 person a pair, shadow a pair

I want to hold hands with you in the shadow of apricot flowers, watch a flower bloom and fall, and feel the warmth of spring.

I want to walk with you on the snowy streets in the frozen city, listen to the rustling of falling snow, and feel the pure white silence of winter.

I want to be with you in the ordinary fireworks years, watch the wind and the moon together, and wait until the end of the year.


2 Is our perception a vacuum channel?

        We have been taught light wavelengths and sound waves since junior high school. At that time, we learned physics and felt that our perception was a vacuum channel, and the various worlds in front of us were the real objective world. Since listening to Professor Shi Yigong's lecture, the original cognition has been subverted. (The first on the left is Shi Yigong, the second is Yang Zhenning, yyds!)

2.1 Vision

       Take vision and hearing as an example: vision accounts for about 70%-80% of human information perception, but it is only a functional performance of the biological photoreceptor system, and its natural evolution origin is the simplest photosynthetic energy metabolism of lower organisms. related. Therefore, it is only sensible to light waves between 400-700 nanometers within the illuminance limited by a certain evolutionary environment, that is to say, any object that does not emit light and reflect light within this range can be considered non-existent for vision. Or, objects that do not exhibit their properties by luminescence and reflection are non-existent to vision.

      Moreover, the world is colorless. The so-called "color" is just the sensory conversion product of visible light wavelengths acting on the visual system . Mixed light produces white light perception. The human eye can produce different color perceptions as long as the light waves of a single wavelength differ by 5 nanometers. Therefore, more than 150 different "colors" can be transformed from light waves between 400-700 nanometers, mainly including: red (700-610) , orange (610-590), yellow (590-570) , green (570-500) , blue (500-460) , blue (460-440) , purple (440-400) and other 7 colors. Just imagine, if the structure of the human eye was originally a spectrophotometer, would the world still have color?   

2.2 Hearing

      Similarly, the world is silent, the so-called "sound" is nothing but the "illusion" caused by the stimulation of the auditory organs by mechanical vibration waves of 20-20,000 Hz. The fault is that this "sound" does not reflect "what is sound", but makes the listener mistakenly think that "sound" is directly an objective sound even outside the ear. And it's not just the eardrum, the cochlear membrane cells, and the auditory nerve center that cause this error. Even the external auditory canal is at work, causing the small needle frequency to become a loud sound. It is equivalent to saying that the infrasound wave below 20HZ is inaudible to the human ear, and the ultrasonic wave above 20,000HZ is also inaudible to the human ear. The range of shock waves we can hear is very narrow. If the structure of the human ear was originally a vibration wavelength measuring instrument, would the world still have sound?

     Just like what we input to the computer is essentially only 0 and 1, but what the computer shows us is a very realistic picture. Our senses are prescriptive, not a true reflection of the objective world. Of course, there is no denying that there is a real objective world outside. Do you still think "seeing is believing"?


3 WeChat Moments Automatic Likes (Python code implementation) 

3.1 Like it

3.2 Knowledge Reserve

(1) With the help of Uiautomator2, automation can be realized

UiAutomator is a Java library provided by Google for Android automated testing. It can obtain any control property of any APP on the screen and perform arbitrary operations on it. Uiautomator2 is a python interface package on top of Uiautomator. In short, Uiautomator2 can see which controls are on the current screen of the mobile phone, what their coordinates are, and can also simulate clicks.

(2) Installation and use of Uiautomator2

For details, please refer to the official document Uiautomator2  . The installation method is very simple. The following command is enough:

pip install --upgrade --pre uiautomator2

If you use it, there are several pits here. Before connecting the mobile phone to the computer, you need to turn on the developer mode, and enable USB debugging and USB installation  (as shown in the figure below), so as to ensure that uiautomator2 has enough permissions to operate your mobile phone.

                                        

After using uiautomator2 for the first time, it will install the ATX application on your mobile phone. Open this application and you can then operate your mobile phone wirelessly.

                               

3.3 Python code

import uiautomator2 as u2
import time

d = u2.connect()  # 有线连接,手机需要插电脑上
#d = u2.connect("147.2588.0.102")  #通过无线连接,电脑和手机需要在同一个局域网内,并且需要先用有线的方式做过初始化


d.app_start("com.tencent.mm")
time.sleep(0.3)
d(text="发现").click()
time.sleep(0.3)
d(text="朋友圈").click()

def click():
    time.sleep(0.2)
    d.xpath("//*[@resource-id='com.tencent.mm:id/kn']").click()
    time.sleep(0.2)
    if d.xpath("//*[@text='赞']").exists:
        time.sleep(0.2)
        d(text="赞").click()
        time.sleep(0.1)
        return True
    time.sleep(0.3)
    return False


def swipeDown():
    a = d.xpath("//*[@resource-id='com.tencent.mm:id/kn']")
    y = a.get().bounds
    dist = y[3]
    if dist < 200:
        dist = 220
    d.swipe(300, dist, 300, 50, 0.2)
    time.sleep(0.1)


cnt = 0
while True:
    if d.xpath("//*[@text='5小时前']").exists:
        break
    if click() == False:
        cnt = cnt + 1
    if cnt > 2:
        break
    swipeDown()

Thanks:

https://blog.csdn.net/xindoo/article/details/113791863 

Guess you like

Origin blog.csdn.net/weixin_46039719/article/details/124049320