qsniyg / rssit

RSS Feed Generator
MIT License
62 stars 23 forks source link

Getting Facebook page rss #12

Open cmutts opened 3 years ago

cmutts commented 3 years ago

Hi, thanks for rssit. I have setup and run rssit on my centos VPS. Trying to get rss for my Facebook page, and Twitter handle. For Twitter, I am only getting the atom link without the Twitter posts like this below

https://twitter.com/simbaradio simbaradio 2021-04-15T00:28:58.127839+00:00 python-feedgen @simbaradio's twitter

While Facebook I get an error message that it requires an access token. The configuration does not mention anything about this. Please help. I need an rss feed setup that I use in a feed reader. Thanks

qsniyg commented 3 years ago

If it's a facebook page (and not a profile), I believe it should still work with facebook's graph API (I forget how to get an access token, but there should be tutorials online on how to do this). I deleted my FB account a while ago so I can't really test for the moment sorry. Otherwise, I guess scraping could always be an option.

Twitter also requires an access token, but I believe they locked that down last year or something. I think the only solution there would be to scrape using their browser API, which is rather heavily locked down unfortunately (getting it to work on my other project - maxurl - was a huge pain haha). I'll try to look into this later :)

cmutts commented 3 years ago

Thanks.. Its a Facebook page. Facebook has many tokens - user token, page access token and the app access token. I guess it's one of these. My challenge is where do I insert it? By editing the facebook.py file under generators ?

PeterDaveHello commented 3 years ago

Yeah, I got the same issue here, it's a Facebook page, not personal profile, and here's the error:

Traceback (most recent call last):
  File "/home/peterdavehello/temp/rssit/rssit/paths/feed.py", line 175, in process
    result = rssit.generator.process(server, config, newpath)
  File "/home/peterdavehello/temp/rssit/rssit/generator.py", line 91, in process
    process_result = process_generator(generator, server, config, splitted)
  File "/home/peterdavehello/temp/rssit/rssit/generator.py", line 65, in process_generator
    return generator["endpoints"][splitted[1]]["process"](server, config, "/".join(splitted[2:]))
  File "/home/peterdavehello/temp/rssit/rssit/generators/facebook.py", line 281, in generate_user
    user_info = get_user_info(graph, user)
  File "/home/peterdavehello/temp/rssit/rssit/generators/facebook.py", line 45, in get_user_info
    user_infos[user] = graph.get_object(user + "?fields=name,username,about,description,link")
  File "/home/peterdavehello/temp/rssit/local/lib/python3.5/site-packages/facebook/__init__.py", line 126, in get_object
    return self.request("{0}/{1}".format(self.version, id), args)
  File "/home/peterdavehello/temp/rssit/local/lib/python3.5/site-packages/facebook/__init__.py", line 313, in request
    raise GraphAPIError(result)
facebook.GraphAPIError: An access token is required to request this resource.
qsniyg commented 3 years ago

Sorry for the late reply. Edit ~/.config/rssit/config.ini with the following:

[facebook]
app_id = ...
app_secret = ...
redirect_url = http://localhost:8123/f/facebook/access_2
access_token = ... # fill in once you get the access token

If you're using an app token, just go to http://localhost:8123/f/facebook/access_app, and it should print out the access token. If you want an oauth token, go to http://localhost:8123/f/facebook/access instead.

I haven't tested this in a very long time however, so it could be broken.