Merge pull request #362 from ZeusWPI/fix-facebook
Fix facebook the way it should be fixed
This commit is contained in:
commit
986fb9c61d
2 changed files with 0 additions and 41 deletions
11
README.md
11
README.md
|
@ -73,17 +73,6 @@ Once you've submitted a PR, it will automatically be deployed to (PR#).pr.zeus.g
|
|||
|
||||
Analytics are powered by [Fathom](https://usefathom.com) and are available on <https://stats.zeus.gent>. These are only available to administrators with proper rights. These analytics are self hosted and provide only simple statistics for our information, without breaching your privacy.
|
||||
|
||||
## Import event from Facebook
|
||||
|
||||
You can import events from Facebook with `bundle exec nanoc fetch #{event_id}`.
|
||||
You will need to create a `.fb_token` file and request an API token to put in there, see [FB graph API](https://developers.facebook.com/tools/explorer/).
|
||||
|
||||
You will probably need to make a new app (see navbar, it's quite trivial), unless you already have a Zeus site app.
|
||||
|
||||
You need to create a User Token with `user_events` permission.
|
||||
|
||||
We currently request from v2.10, details about the code can be found in [./commands/fetch].
|
||||
|
||||
## Built With
|
||||
|
||||
* [nanoc](https://github.com/nanoc/nanoc), static site generator
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
|
||||
usage 'fetch [facebook event id]'
|
||||
aliases :f
|
||||
summary 'Fetch an event from facebook'
|
||||
description 'Fetch an event from facebook'
|
||||
|
||||
run do |_opts, args, _cmd|
|
||||
fb_token = File.read('.fb_token')
|
||||
event_id = args[0]
|
||||
uri = URI("https://graph.facebook.com/v2.10/#{event_id}?fields=cover,name,description,start_time,place,end_time&access_token=#{fb_token}")
|
||||
o = JSON.parse(Net::HTTP.get(uri))
|
||||
puts <<~EOS
|
||||
---
|
||||
title: "#{o['name']}"
|
||||
description: #Fill in
|
||||
time: #{o['start_time']}
|
||||
end: #{o['end_time']}
|
||||
location: #{o['place']['name']}
|
||||
banner: #{o['cover']['source']}
|
||||
created_at: #Fill in
|
||||
facebook: 'https://www.facebook.com/events/#{event_id}/'
|
||||
---
|
||||
|
||||
#{o['description']}
|
||||
EOS
|
||||
end
|
Loading…
Reference in a new issue