Created
October 18, 2017 02:10
-
-
Save DonerKebab/1b930cc6bc0b828057f6ceadb37257f1 to your computer and use it in GitHub Desktop.
A script that auto scan from csv file row by row then publish post using row data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# csv format: content | link_to_website | |
import requests | |
import csv | |
import json | |
import time | |
PAGE_ID = 'your_facebook_page_id' # find page id : https://findmyfbid.com | |
ACCESS_TOKEN = 'your_app_access_token' # https://developers.facebook.com/tools/explorer | |
REQUEST_FORM = 'https://graph.facebook.com/PAGE_ID/feed?message=TITLE&link=PRODUCT_LINK' | |
CSV_FILE = 'path_to_csv' | |
DATA = {'access_token': ACCESS_TOKEN} | |
with open(CSV_FILE, 'r') as csvfile: | |
reader = csv.reader(csvfile, delimiter=',', quotechar='|') | |
for row in reader: | |
request_url = REQUEST_FORM.replace('TITLE', row[0]).replace('PRODUCT_LINK', row[1]) | |
requests.post(request_url, DATA) | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment