Jump to content
Fórum Script Brasil
  • 0

Leitura do facebook


paulo laceda
 Share

Question

Pessoal boa tarde

Sou novo em python, estou precisando de realizar scritps de leitura de informações do facebook. Já segui alguns tutoriais mas todos não muito completos.

Estou fazendo o seguindo código:

import urllib.request

import json

url = 'https://www.facebook.com/me/friends?access_token=CAACEdEose0cBAAx5RR4UqZAseD7ZAvRNGqxO2Cy9wSeWsxUgEBnkpjwWeIdnY8nhkIDZALy3NV5bZCRQmTsnCXkSeK2ZBuS16AqHwG4blqBuJSaZAnWsQyZCxfNZBwa3zQbaDFfRBB4V8bQAspwoJQnQr0PmEZBufsGqtNT0BRO218xQQ4Be36ofvnw4wnCIjOq31nWhkCqOBbgZDZDCAACEdEose0cBABrk9cnC1j0hj5SahfQDezsb8UfzUUcmGnCxxeXZCIZB2tDTvBURHsLOVqPVa0S1cxnS3O83cOrSUXZCkcD7tJFfcUApQRBX0o4jp7E4LH87EffuDzmXnZCaMtbKppagS060aYc08QTQOGlhaexHKQxfqO8CEQsgzTeVOZAGxQmqhrSAxNk9rykgY9FEDdwZDZD'

urlfile = urllib.request.urlopen(url).read().decode('utf-8')

j = json.loads(urlfile)

for amigo in j['j']:

print (amigo['name'])

 

Gera um erro na saída, embora na vídeo aula o código funciona:

 

Traceback (most recent call last):

File "C:\Users\Paulo\Desktop\workspace\TEste\src\Teste.py", line 7, in <module>

j = json.loads(urlfile)

File "C:\python\lib\json\__init__.py", line 319, in loads

return _default_decoder.decode(s)

File "C:\python\lib\json\decoder.py", line 339, in decode

obj, end = self.raw_decode(s, idx=_w(s, 0).end())

File "C:\python\lib\json\decoder.py", line 357, in raw_decode

raise JSONDecodeError("Expecting value", s, err.value) from None

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

 

Alguém sabe me dizer qual o problema? Estou usando python 3.5. Preciso de um help urgente.

Grato.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...