-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Automated Reposting? #6
Comments
This is on the TODO list. I intend to add a scriptable version of this project so that all features can be called via the command line only. |
I have noticed that there is a third-party project that uses this project as a dependency in order to automate ad reposting. I have not used it myself but it may be useful to some. |
Hi @jackm, Thanks for sharing that resource. I ended up putting a solution for myself together. I make a HTTP request to the repost_all URL. The scripts runs as a service on a systemd timer on Ubuntu. Here it is if you or anyone else is interested: Script to make HTTP request to repost ads ( import yaml
import time
import creds
import requests
from bs4 import BeautifulSoup
def initial_login(http_session, payload):
"""
Logs in
Takes, CSRF_token
Updates payload with CSRF token for additional request
"""
login_url = "http://192.168.1.25:5000/login"
response = http_session.post(login_url, data=payload)
html_string = response.text
soup = BeautifulSoup(html_string, 'html')
token = soup.find('input', {'name':'csrf_token'})['value']
payload['csrf_token'] = token
def final_login_and_repost_ads(http_session, payload):
login_url = "http://192.168.1.25:5000/login"
http_session.post(login_url, data=payload)
def repost_ads(http_session, payload):
repost_url = "http://192.168.1.25:5000/repost_all"
repost_ads = http_session.get(repost_url, data=payload)
def pushover_message(message):
url = "https://api.pushover.net/1/messages.json"
payload={'token': creds.app_id,
'user': creds.user_id,
'message': message,
'title': 'Kijiji Reposter'}
requests.request("POST", url, data=payload)
if __name__ == "__main__":
try:
pushover_message('Kijiji Reposter Started')
print('pushover message sent!!!!!!!!!!!!!!!!!!!!!!!!!!')
yaml_file = open('accounts.yaml')
accounts = yaml.load(yaml_file, Loader=yaml.FullLoader)
for k, v in accounts.items():
payload = {
"email": v['email'],
"password": v['password']
}
http_session = requests.Session()
initial_login(http_session, payload)
final_login_and_repost_ads(http_session, payload)
repost_ads(http_session, payload)
time.sleep(240)
pushover_message('Kijiji Ads Reposted')
except Exception as e:
pushover_message(f"""Kijiji reposter ran into issues:
{e}
Check journalctl logs for more details""") Example of account1:
email: 1yourkijijiaccount@account.com
password: yourkijijiaccountpassword
account2:
email: 2yourkijijiaccount@account.com
password: yourkijijiaccountpassword Service file [Unit]
Description=Kijiji Manager Repost Trigger
After=network.target
[Service]
WorkingDirectory=/home/ubuntu/scripts/kijiji_repost_trigger
Environment="PATH=/home/ubuntu/scripts/kijiji_repost_trigger/.venv/bin"
ExecStart=/home/ubuntu/scripts/kijiji_repost_trigger/.venv/bin/python3 -m repost_trigger
TimeoutSec=300
[Install]
WantedBy=multi-user.target Systemd Timer File: [Unit]
Description=Kijijireposter timer
[Timer]
Unit=kijiji_manager_repost_trigger.service
# OnCalendar=*-*-* 18:00:00 Everyday at 18:00
OnCalendar=Fri 18:00:00
OnCalendar=Sun 09:00:00
OnCalendar=Tue 18:00:00
Persistent=true
[Install]
WantedBy=multi-user.target |
@rockerguy1978 is the above still working for you? |
Hi @apple-cmd, the script works no issue. However, I am also having the same issues documented in #62. My ads are deleted after reposting, unfortunately. |
@rockerguy1978 I think someone wrote a little script there to change the titles automatically |
Hi,
Great project so far! I just set this up and was able to repost all my ads for the two Kijiji accounts that I manage.
Are there plans to support the ability to automate reposting? I was posting ads a couple of times a week and it was completely hands-off. I previously was running the https://github.com/ArthurG/Kijiji-Repost-Headless project as a service with some systemd timers to automate launching the service at certain dates/times...
I imagine supporting a scheduling feature in the GUI would be more involved but more user friendly. Is that something that is likely to be developed in the future?
Alternatively, is it possible to create an API that can be called with a web request at the
/repost_all
URL? I.E. send the creds of the account with a repost function? I suspect this could be possible right now, but haven't dove into the code too much. If that's possible, I think creating some documentation on that would be helpful to others!The text was updated successfully, but these errors were encountered: