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

instagram: oembed endpoint deprecated #1

Open
r4f4 opened this issue Dec 3, 2020 · 3 comments
Open

instagram: oembed endpoint deprecated #1

r4f4 opened this issue Dec 3, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@r4f4
Copy link

r4f4 commented Dec 3, 2020

Description

When sopel tries to get info on an instagram link it fails with the message:

Unexpected error (Expecting value: line 1 column 1 (char 0)) from <user> at 2020-12-03 16:08:50.365477. Message was: [...]

That happens because, instead of a json, sopel gets the following message:

This endpoint is deprecated. Please read https://developers.facebook.com/docs/instagram/oembed  to learn how to migrate your endpoint

So not only has the endpoint changed, but it also requires an access token now.

Reproduction steps

  1. Have the instagram plugin enabled
  2. Connect to server, join a channel, ...?
  3. Send the bot a message containing an instagram url
  4. The bot displays an error message

Expected behavior

Sopel is able to display instagram metadata

Logs

[2020-12-03 16:08:50,365] sopel.bot            ERROR    - Unexpected error (Expecting value: line 1 column 1 (char 0)) from <user> at 2020-12-03 16:08:50.365477. Message was: https://www.instagram.com/p/CIV90SGp5uL/
Traceback (most recent call last):
  File "/home/sopel/sopel/bot.py", line 643, in call_rule
    rule.execute(sopel, trigger)
  File "/home/sopel/sopel/plugins/rules.py", line 921, in execute
    exit_code = self._handler(bot, trigger)
  File "/home/sopel/sopel/plugins/rules.py", line 1482, in execute_handler
    return handler(bot, trigger, match=trigger)
  File "/home/sopel/sopel/modules/instagram.py", line 51, in instaparse
    json = get_oembed_json(instagram_url)
  File "/home/sopel/sopel/modules/instagram.py", line 67, in get_oembed_json
    return response.json()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 850, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

Environment

  • Sopel .version: 82e3939a471e5f4d2909a8fb3cfbdad6d14388c9
  • Sopel installed via: source
  • Python version: 3.6.8
  • Operating system: Centos 7
  • Relevant plugins: instagram

Notes

Anything else we should know?

@dgw
Copy link
Member

dgw commented Dec 3, 2020

I don't think Facebook understands what "deprecated" means. Deprecated stuff should still work, just with a warning that it will stop working later. The state described here is "unavailable".

Self-assigning to move instagram.py into a standalone repo. Insta's clearly moving toward key-only access, which is incompatible with our core plugin policy (which is essentially "it has to Just Work").

@dgw dgw self-assigned this Dec 3, 2020
dgw referenced this issue in sopel-irc/sopel Dec 12, 2020
As reported in #1996, Facebook "deprecated" the oEmbed API endpoint.
However, instead of a true deprecation where the endpoint simply starts
returning a warning (or even just is marked as deprecated in docs), FB
essentially *removed* the endpoint. It no longer returns valid JSON at
all, let alone the expected result. Sopel receives plain text stating
that the endpoint is "deprecated", with a link for more details.

The replacement API endpoint requires an API key, and this seems like a
good time to consider removing the Instagram plugin to its own package.
I will prepare that change separately, mostly so this fix can be easily
cherry-picked into 7.0.x for maintenance, but also because it could be
enough to wait for removing the plugin entirely until Sopel 8.0.

I'm not personally signed up for Instagram's developer program, so it
wouldn't be fair if I alleged that FB never sent a warning before this
endpoint stopped working. They might have. I'm just taking issue with
the use of the term "deprecated" for something that is *nonfunctional*
rather than merely unmaintained or scheduled for removal.
@dgw dgw transferred this issue from sopel-irc/sopel Jan 21, 2021
@dgw dgw added the bug Something isn't working label Jan 21, 2021
@dgw
Copy link
Member

dgw commented Jan 21, 2021

Realized that sopel-irc/sopel#2000 obsoleted this issue in its original location, so it made sense to move it over to this standalone plugin repo.

@dgw
Copy link
Member

dgw commented Dec 12, 2023

Should anyone wish to work on this, using an InstaFix instance as the "backend" seems sanest.

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