Coder Social home page Coder Social logo

justinlittman / fbarc Goto Github PK

View Code? Open in Web Editor NEW
77.0 16.0 11.0 115 KB

A commandline tool and Python library for archiving data from Facebook using the Graph API.

License: Creative Commons Zero v1.0 Universal

Python 97.05% HTML 2.95%
code4lib facebook-graph-api

fbarc's Issues

could not build url for endpoint node

python3 fbarc.py graph page MarkRWarner | python fbarc_viewer.py
Warning: Using an app token. You may encounter authorization problems.
Getting graph for node MarkRWarner

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 488, in _get_nodes
node_graph_dict[node_ids[0]] = self.get_node(node_ids[0], definition_name)
File "fbarc.py", line 567, in get_node
raise e
File "fbarc.py", line 546, in get_node
node_graph = self._perform_http_post(url, data=params)
File "fbarc.py", line 914, in _perform_http_post
**kwargs)
File "fbarc.py", line 914, in _perform_http_post
**kwargs)
File "fbarc.py", line 914, in _perform_http_post
**kwargs)
[Previous line repeated 5 more times]
File "fbarc.py", line 910, in _perform_http_post
raise e
File "fbarc.py", line 875, in _perform_http_post
raise_for_fb_exception(response, data=data)
File "fbarc.py", line 432, in raise_for_fb_exception
raise FbException(error_response)
main.FbException: Unsupported get request. Object with ID 'MarkRWarner' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "fbarc.py", line 1132, in
main()
File "fbarc.py", line 213, in main
args.csv_output_dir, fb)
File "fbarc.py", line 255, in graph_command
exclude_definition_names=exclude_definition_name), graph_outputs)
File "fbarc.py", line 260, in print_graphs
for graph in graph_iter:
File "fbarc.py", line 476, in get_nodes
for node_graph in self._get_nodes(node_counter, node_queue, queued_nodes, levels, exclude_definition_names):
File "fbarc.py", line 512, in _get_nodes
log.warning('Skipping %s due to unexpected GraphMethodException: %s', node_id, e)
UnboundLocalError: local variable 'node_id' referenced before assignment

  • Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
    [2018-01-14 16:56:01,616] ERROR in app: Exception on / [GET]
    Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
    File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
    File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
    File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functionsrule.endpoint
    File "fbarc_viewer.py", line 32, in home
    return redirect(url_for('node', node_id=first_node_id))
    File "/usr/lib/python2.7/dist-packages/flask/helpers.py", line 333, in url_for
    return appctx.app.handle_url_build_error(error, endpoint, values)
    File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1805, in handle_url_build_error
    reraise(exc_type, exc_value, tb)
    File "/usr/lib/python2.7/dist-packages/flask/helpers.py", line 323, in url_for
    force_external=external)
    File "/usr/lib/python2.7/dist-packages/werkzeug/routing.py", line 1768, in build
    raise BuildError(endpoint, values, method, self)
    BuildError: Could not build url for endpoint 'node'. Did you forget to specify values ['node_id']?
    127.0.0.1 - - [14/Jan/2018 16:56:01] "GET / HTTP/1.1" 500 -

Search idea

Here is an idea that you could use for your search function. It returns as a dict though which makes parsing a pain.

users = graph.request('/search?q='+q+'&type=user')

This can be expanded as needed, but it works for users.

JSONDecodeError

How can I find out why there was a problem with the JSON?

Full error message:

python fbarc.py --debug graph page altenbeken.info --levels 2 > altenbeken.jsonl
Access token expires on 2018-03-04 10:21:56+00:00
Getting graph for node altenbeken.info
Traceback (most recent call last):
  File "fbarc.py", line 476, in raise_for_fb_exception
    raise FbException(error_response)
__main__.FbException: An unknown error has occurred.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "fbarc.py", line 1156, in <module>
    main()
  File "fbarc.py", line 214, in main
    args.csv_output_dir, fb)
  File "fbarc.py", line 273, in graph_command
    exclude_definition_names=exclude_definition_name), graph_outputs)
  File "fbarc.py", line 298, in print_graphs
    for graph in graph_iter:
  File "fbarc.py", line 522, in get_nodes
    for node_graph in self._get_nodes(node_counter, node_queue, queued_nodes, le
vels, exclude_definition_names):
  File "fbarc.py", line 536, in _get_nodes
    node_graph_dict = self.get_node_batch(node_ids, definition_name)
  File "fbarc.py", line 617, in get_node_batch
    nodes_graph_dict = self._perform_http_post(url, data=params)
  File "fbarc.py", line 908, in _perform_http_post
    raise_for_fb_exception(response, data=data)
  File "fbarc.py", line 477, in raise_for_fb_exception
    except json.decoder.JSONDecodeError:
AttributeError: 'module' object has no attribute 'JSONDecodeError'

debug.log

2018-01-05 12:05:15,428 ERROR Error for https://graph.facebook.com/v2.11 ({'fields': 'id,metadata{type},description,end_time,event_times,name,start_time,attending_count,category,cover,declined_count,interested_count,is_canceled,maybe_count,noreply_count,owner,picture,place,timezone,type,updated_time,comments.limit(2000){id,created_time,from,message,permalink_url},feed.limit(25){id,created_time,from,message,permalink_url,status_type,to,updated_time},live_videos.limit(100){id,creation_time,description,permalink_url,title},photos.limit(100){id,created_time,link,name,updated_time}', 'access_token': 'XXXXXX', 'ids': '330364757445239,1785087901790238,1778205972478904,1348214928621073,215387655660218,268732113631738,396768557350139,1633347510043387,1027045984065537,139391659967274,1523274661042677,1832586256990227,985206564948474,300970570319747,193476294470573,238752436577395,1178518992264453,580038218861570,180063365812330,237478843337911', 'method': 'GET', 'metadata': 1}): {
    "error": {
        "message": "An unknown error has occurred.",
        "code": 1,
        "fbtrace_id": "A98KjDQxfoZ",
        "type": "OAuthException"
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.