threads-py icon indicating copy to clipboard operation
threads-py copied to clipboard

the code doesn't seem to work for me

Open DanishjeetSingh opened this issue 1 year ago • 21 comments

i tried to run app.py i get this when I try to get user_id

{'data': None, 'errors': [{'message': 'A server error noncoercible_field_result occured. Check server logs for details.', 'severity': 'ERROR'}], 'extensions': {'is_final': True}}
26444807

DanishjeetSingh avatar Jul 06 '23 22:07 DanishjeetSingh

tbh I haven't got a chance check this out. I promise to test and package the Python version soon too!

junhoyeo avatar Jul 06 '23 22:07 junhoyeo

I found the same issue. thanks for the hard work.

moosl avatar Jul 07 '23 06:07 moosl

Running:

api = ThreadsAPI()

username = "stkildafc"

user_id = api.get_user_id_from_username(username)
user_profile = api.get_user_profile(username)
user_threads = api.get_user_profile_threads(username)

print(user_id)
print("\n", user_profile)
print("\n", user_threads)

This is what I get:

{'data': None, 'errors': [{'message': 'A server error noncoercible_field_result occured. Check server logs for details.', 'severity': 'ERROR'}], 'extensions': {'is_final': True}}
26444807

 {'is_private': False, 'profile_pic_url': 'https://scontent.cdninstagram.com/v/t51.2885-19/358096727_3588265128116746_1695549457359323889_n.jpg?stp=dst-jpg_s150x150&_nc_ht=scontent.cdninstagram.com&_nc_cat=110&_nc_ohc=H3G-6tEtE-YAX9Wh8_T&edm=APs17CUBAAAA&ccb=7-5&oh=00_AfAE8VxTGb1kuuBLyqoIyV22bOTgL46lXi8v0S0Envnm6g&oe=64AD5164&_nc_sid=10d13b', 'username': 'stkildafc', 'hd_profile_pic_versions': [{'height': 320, 'url': 'https://scontent.cdninstagram.com/v/t51.2885-19/358096727_3588265128116746_1695549457359323889_n.jpg?stp=dst-jpg_s320x320&_nc_ht=scontent.cdninstagram.com&_nc_cat=110&_nc_ohc=H3G-6tEtE-YAX9Wh8_T&edm=APs17CUBAAAA&ccb=7-5&oh=00_AfC589pGhhd5hsxbvmdhVpWczY7uQqMcjAXokJFH0-SZDw&oe=64AD5164&_nc_sid=10d13b', 'width': 320}], 'is_verified': True, 'biography': 'Home of #SaintsFooty 😇', 'biography_with_entities': None, 'follower_count': 3789, 'profile_context_facepile_users': None, 'bio_links': [{'url': 'https://www.saints.com.au/'}], 'pk': '26444807', 'full_name': 'St Kilda Football Club', 'id': None}

 {'data': None, 'errors': [{'message': 'A server error noncoercible_field_result occured. Check server logs for details.', 'severity': 'ERROR'}], 'extensions': {'is_final': True}}

frapierri avatar Jul 07 '23 10:07 frapierri

Okay I'll really start working on this thing

junhoyeo avatar Jul 07 '23 13:07 junhoyeo

It's working now. Any suggestions for handling this exception? I guess I made two many calls in a row.

TooManyRedirects: Exceeded 30 redirects.

frapierri avatar Jul 07 '23 21:07 frapierri

I think the response format has changed because the script doesn't work to me anymore :(

frapierri avatar Jul 08 '23 09:07 frapierri

I wonder why this thing does not works on normal code but it's unittest seems to work

mirageoasis avatar Jul 09 '23 15:07 mirageoasis

This is the error that I get for Get Thread From Post ID:

\site-packages\dataclasses_json\core.py:184: RuntimeWarning: `NoneType` object value of non-optional type data detected when decoding GetUserProfileThreadResponse.
  warnings.warn(
ThreadData(reply_threads=[], containing_thread=None)

abdhan avatar Jul 09 '23 15:07 abdhan

@abdhan I figured out why get_user_id_from_username returns boolean which cause parameter type mismatch

mirageoasis avatar Jul 09 '23 15:07 mirageoasis

This is the error that I get for Get Thread From Post ID:

\site-packages\dataclasses_json\core.py:184: RuntimeWarning: `NoneType` object value of non-optional type data detected when decoding GetUserProfileThreadResponse.
  warnings.warn(
ThreadData(reply_threads=[], containing_thread=None)

That's not an error, it's a warning message about the dataclasses-json package.

Mineru98 avatar Jul 09 '23 16:07 Mineru98

@abdhan I figured out why get_user_id_from_username returns boolean which cause parameter type mismatch

@mirageoasis I've merged PR #14 and fixed all the code related to the changes in PR #16 .

Mineru98 avatar Jul 09 '23 16:07 Mineru98

Thanks for the explanation.

abdhan avatar Jul 09 '23 16:07 abdhan

@frapierri said:

It's working now.

How'd you fix that?

{
    "data": null,
    "errors": [
        {
            "message": "A server error noncoercible_field_result occured. Check server logs for details.",
            "severity": "ERROR"
        }
    ],
    "extensions": {
        "is_final": true
    }
}

on get_threads

stevenlafl avatar Jul 09 '23 23:07 stevenlafl

@frapierri said:

It's working now.

How'd you fix that?

{
    "data": null,
    "errors": [
        {
            "message": "A server error noncoercible_field_result occured. Check server logs for details.",
            "severity": "ERROR"
        }
    ],
    "extensions": {
        "is_final": true
    }
}

on get_threads

can you show me your code?

mirageoasis avatar Jul 10 '23 00:07 mirageoasis

here's another library for threads in python. I believe this seems to work for now https://github.com/dmytrostriletskyi/threads-net

DanishjeetSingh avatar Jul 10 '23 00:07 DanishjeetSingh

here's another library for threads in python. I believe this seems to work for now https://github.com/dmytrostriletskyi/threads-net

code still not working? if you update package I think it will work if it doesn't can you show me your code?

mirageoasis avatar Jul 10 '23 00:07 mirageoasis

Looks like they keep changing the endpoint on the Threads side, so it's gonna be hellish for the next few weeks....

p.s. the JS version still works great, kudos to @junhoyeo once again

frapierri avatar Jul 10 '23 10:07 frapierri

Looks like they keep changing the endpoint on the Threads side, so it's gonna be hellish for the next few weeks....

p.s. the JS version still works great, kudos to @junhoyeo once again

show us the code you ran.

Mineru98 avatar Jul 10 '23 10:07 Mineru98

Looks like they keep changing the endpoint on the Threads side, so it's gonna be hellish for the next few weeks.... p.s. the JS version still works great, kudos to @junhoyeo once again

show us the code you ran.

I just ran the examples. I also tried the other library (https://github.com/dmytrostriletskyi/threads-net) but I get unstable results (working with "zuck" but not with other random usernames).

frapierri avatar Jul 10 '23 10:07 frapierri

@frapierri said:

It's working now.

How'd you fix that?

{
    "data": null,
    "errors": [
        {
            "message": "A server error noncoercible_field_result occured. Check server logs for details.",
            "severity": "ERROR"
        }
    ],
    "extensions": {
        "is_final": true
    }
}

on get_threads

can you show me your code?

I was actually trying to convert your python into javascript. But I found the library by @elijah-wright so he had already done this.

https://github.com/stevenlafl/threads-web-client/blob/master/src/pages/api/feed.ts

image

Thanks though!

stevenlafl avatar Jul 10 '23 15:07 stevenlafl

I got the noncoercible_field_result error when I was querying with the wrong account (that has a Instagram profile but hadn't registered to Threads yet)

junhoyeo avatar Jul 16 '23 14:07 junhoyeo