Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

row_feed_photo_profile_name contains text/desc object only for video #372

Closed
mastrolube opened this issue Feb 25, 2024 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@mastrolube
Copy link
Contributor

row_feed_photo_profile_name which is supposed to contain the name of the page that posted content, is no longer containing that precious info. Only for video, it's still there.
It looks like a bug to me but a workaround could be to OCR that element.
Maybe pytesseract would be the correct repo to use?

@mastrolube mastrolube added the bug Something isn't working label Feb 25, 2024
@mastrolube
Copy link
Contributor Author

%pip install pytesseract
import uiautomator2 as u2
import pytesseract as pt
pt.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

d = u2.connect()
screenshot = d.screenshot()
obj = d(resourceId="com.instagram.android:id/row_feed_photo_profile_name")
bounds = obj.info["bounds"]
screenshot_cropped = screenshot.crop([bounds.get("left"), bounds.get("top"), bounds.get("right"), bounds.get("bottom")])
screenshot_cropped.show()
text = pt.image_to_string(screenshot_cropped)  
print(text)

mastrolube added a commit that referenced this issue Feb 25, 2024
#372
it works for feed job
- for windows you have also to install manually the exe of tesseract: https://github.com/UB-Mannheim/tesseract/wiki
@sagirab
Copy link

sagirab commented Mar 18, 2024

Hey there,
I get this error and I think this is related to this topic.

[03/18 18:31:47] INFO | Scroll down to see next post.
[03/18 18:31:50] INFO | Can't find the owner name, need to use OCR.
[03/18 18:31:51] ERROR | You need to install Tesseract (the engine: it depends on your system) in order to use OCR feature.
[03/18 18:31:51] ERROR | Traceback (most recent call last):

I tried to install tesseract but seems like I failed. How can I resolve this issue ?

@mastrolube
Copy link
Contributor Author

the bot shouldn't crash with 3.2.12. update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants