derrickx 1 жил өмнө
parent
commit
c5cde72764

BIN
facebook/screenshots/1715094110.900465.png


BIN
facebook/screenshots/1715094163.686677.png


BIN
facebook/screenshots/1715094200.312835.png


BIN
facebook/screenshots/1715094267.727485.png


BIN
facebook/screenshots/1715094370.4556742.png


BIN
facebook/screenshots/1715094434.640671.png


BIN
facebook/screenshots/1715094522.179156.png


+ 0 - 59
facebook/spider_poc.py

@@ -1,59 +0,0 @@
-import os
-import sys
-import time
-
-import uiautomator2 as u2
-from cnocr import CnOcr
-
-
-def spider_poc(serial):
-    d = u2.connect(serial)
-    d.screen_on()
-    d.unlock()
-    d.debug = False
-
-    d.app_stop("com.facebook.katana")
-    d.app_start("com.facebook.katana", use_monkey=True)
-    time.sleep(3)
-
-    # 搜索
-    d.xpath('//*[@content-desc="搜索"]').click(timeout=3)
-
-    # 点击搜索框
-    d.xpath('//*[@text="搜索"]').click(timeout=3)
-
-    # 输入搜索关键词
-    d(focused=True).set_text('电子元器件')
-    # 点击搜索
-    d.press('enter')
-    time.sleep(6)
-
-    # 点击帖子
-    d.xpath('//*[@content-desc="帖子个搜索结果"]').click(timeout=3)
-    time.sleep(6)
-
-    # 点击展开
-    d.click(0.461, 0.29)
-
-    # 图片识别
-    root_dir = os.path.dirname(sys.argv[0])
-    screenshot_name = f'screenshots/{time.time()}.png'
-    screenshot_dir = os.path.join(root_dir, screenshot_name)
-    d.screenshot().save(screenshot_dir)
-
-    ocr = CnOcr()
-    res = ocr.ocr(screenshot_dir)
-    # print(res)
-
-    # 找到包含“你的快拍”的元素
-    text_before_join = ""
-    for item in res:
-        if item['text'] in '加入':
-            break
-        text_before_join += item['text']
-
-    print(text_before_join)
-
-
-if __name__ == "__main__":
-    spider_poc('5D7HSG5XXCKVBI85')

BIN
instagram/screenshots/1714313789.422389.png


BIN
instagram/screenshots/1714314190.1217852.png


BIN
instagram/screenshots/1714314224.692939.png


BIN
instagram/screenshots/1714314590.5102878.png


BIN
instagram/screenshots/1714314660.021794.png


BIN
instagram/screenshots/1714314880.858568.png


BIN
instagram/screenshots/1714314942.883649.png


BIN
instagram/screenshots/1714315284.970228.png


BIN
instagram/screenshots/1714315370.4075751.png


BIN
instagram/screenshots/1714315449.7598238.png


BIN
instagram/screenshots/1714315502.043844.png


BIN
instagram/screenshots/1714315566.244193.png


BIN
instagram/screenshots/1714315630.654495.png


BIN
instagram/screenshots/1714315682.259264.png


+ 0 - 97
instagram/spider_poc.py

@@ -1,97 +0,0 @@
-import os
-import sys
-import time
-
-import uiautomator2 as u2
-from cnocr import CnOcr
-
-
-def say_poc(serial):
-    d = u2.connect(serial)
-    d.screen_on()
-    d.unlock()
-    d.debug = False
-
-    d.app_stop("com.instagram.android")
-    d.app_start("com.instagram.android", use_monkey=True)
-    time.sleep(3)
-
-    """搜索"""
-    d.xpath('//*[@resource-id="com.instagram.android:id/search_tab"]/android.widget.ImageView[1]').click(timeout=3)
-    time.sleep(1)
-    d.xpath('//*[@resource-id="com.instagram.android:id/action_bar_search_edit_text"]').click(timeout=3)
-    d(focused=True).set_text('wudejames')
-    time.sleep(3)
-    if d.xpath('//*[@resource-id="com.instagram.android:id/row_search_user_username"]').get_text() == 'wudejames':
-        d.xpath('//*[@resource-id="com.instagram.android:id/row_search_user_username"]').click()
-
-        """发消息"""
-        d.xpath('//*[@text="发消息"]').click(timeout=3)
-
-        """如果存在弹出框"""
-        if d.xpath('//*[@resource-id="com.instagram.android:id/bb_primary_action"]').exists:
-            d.xpath('//*[@resource-id="com.instagram.android:id/bb_primary_action"]').click(timeout=3)
-
-        d.xpath('//*[@resource-id="com.instagram.android:id/row_thread_composer_edittext"]').click(timeout=3)
-        time.sleep(1)
-        d(focused=True).set_text('Good evening')
-        d.xpath('//*[@resource-id="com.instagram.android:id/row_thread_composer_send_button_icon"]').click(timeout=3)
-
-
-def spider_poc(serial):
-    d = u2.connect(serial)
-    d.screen_on()
-    d.unlock()
-    d.debug = False
-
-    d.app_stop("com.instagram.android")
-    d.app_start("com.instagram.android", use_monkey=True)
-
-    time.sleep(3)
-
-    """滑动一屏幕"""
-    # d.swipe_ext('up', scale=1)
-    # time.sleep(1)
-
-    root_dir = os.path.dirname(sys.argv[0])
-    screenshot_name = f'screenshots/{time.time()}.png'
-    screenshot_dir = os.path.join(root_dir, screenshot_name)
-    d.screenshot().save(screenshot_dir)
-
-    ocr = CnOcr()
-    res = ocr.ocr(screenshot_dir)
-    # print(res)
-
-    # 找到包含“你的快拍”的元素
-    target_text = '你的快拍'
-    i = 0
-    for i, item in enumerate(res):
-        if target_text in item['text']:
-            break
-
-    if i < len(res) - 1:
-        next_text = res[i + 1]['text']
-        # print(f"“{target_text}”后的文字是:“{next_text}”")
-        print(f"昵称:{next_text}")
-    else:
-        print("未找到昵称")
-
-    """点赞"""
-    # d.xpath('//*[@resource-id="com.instagram.android:id/row_feed_button_like"]').click(timeout=3)
-    d.double_click(0.51, 0.493)
-    time.sleep(3)
-
-    """搜索"""
-    d.xpath('//*[@resource-id="com.instagram.android:id/search_tab"]/android.widget.ImageView[1]').click(timeout=3)
-    time.sleep(1)
-    d.xpath('//*[@resource-id="com.instagram.android:id/action_bar_search_edit_text"]').click(timeout=3)
-    d(focused=True).set_text('电子元器件')
-    time.sleep(3)
-    d.xpath('//*[@resource-id="com.instagram.android:id/row_search_profile_image"]').click(timeout=3)
-
-    """点击账户"""
-    d.xpath('//*[@text="帐户"]').click()
-
-
-if __name__ == '__main__':
-    say_poc("5D7HSG5XXCKVBI85")

+ 0 - 37
x/spider_poc.py

@@ -1,37 +0,0 @@
-import os
-import sys
-import time
-
-import uiautomator2 as u2
-from cnocr import CnOcr
-
-
-def spider_poc(serial):
-    d = u2.connect(serial)
-    d.screen_on()
-    d.unlock()
-    d.debug = False
-
-    d.app_stop("com.facebook.katana")
-    d.app_start("com.facebook.katana", use_monkey=True)
-    time.sleep(3)
-
-    # 搜索
-    d.xpath('//*[@content-desc="搜索"]').click(timeout=3)
-    d.xpath('//*[@text="搜索"]').click(timeout=3)
-    d(focused=True).set_text('电子元器件')
-
-    d.press('enter')
-
-    root_dir = os.path.dirname(sys.argv[0])
-    screenshot_name = f'screenshots/{time.time()}.png'
-    screenshot_dir = os.path.join(root_dir, screenshot_name)
-    d.screenshot().save(screenshot_dir)
-
-    ocr = CnOcr()
-    res = ocr.ocr(screenshot_dir)
-    print(res)
-
-
-if __name__ == '__main__':
-    spider_poc('5D7HSG5XXCKVBI85')