Download ArticleBuilder articles for your %spin_folder%
I made this script for SER so multiple campaigns can share a single directory of articles and reduce SER's memory footprint. In Articles tab create a new article and point the %spin_folder% to the output folder. To run install python3 and module requests.
import json, requests, time, random
# reference: http://articlebuilder.net/?action=api
# config
action = 'buildArticle' # AB action: categories, buildArticle
article_limit = 400 # set the amount of articles to fetch
path = 'C:/weight loss/' #output directory
#authenticate
api_url = 'http://articlebuilder.net/api.php'
param = {}
param['action'] = 'authenticate'
param['format'] = 'json'
param['username'] = 'your_username'
param['password'] = 'your_password'
resp = requests.get(url=api_url, params=param)
data = json.loads(resp.text)
if data.get('success') == 'true':
session = data.get('session')
if action == 'categories': # see available categories
param.clear()
param['session'] = session
param['format'] = 'json'
param['action'] = 'categories'
resp = requests.get(url=api_url, params=param)
print('URL: ' + resp.url)
data = json.loads(resp.text)
print(data.get('output'))
if action == 'buildArticle': #build article
param.clear()
param['session'] = session
param['action'] = 'buildArticle'
param['format'] = 'json'
param['category'] = 'weight loss'
#param['wordcount'] = random.randint(300,500) # (min = 300, max = 1000)
param['lsireplacement'] = 1
param['spin'] = 1
for i in range(0, article_limit):
# random range for word count
param['wordcount'] = random.randint(300,500) # (min = 300, max = 1000)
resp = requests.get(url=api_url, params=param)
print('URL: ' + resp.url)
data = json.loads(resp.text)
article = data.get('output')
#print(article)
with open( path + param['category'] + '-' + str(time.time()) +'.txt', mode='w', encoding='utf8') as file:
file.write(article)
file.close
print('done!')
Tagged: