Heyoo, long time user, first time poster (please go easy on me).
I am trying to use the Multiscrape HACS integration to pull the calories I have remaining in the day from Lose It! because there is no Lose It! API available for personal projects.
multiscrape:
- name: Scraper McScrapeface
resource: 'https://www.loseit.com/' #method is not defined and defaults to GET
scan_interval: 36000
log_response: True
form_submit:
submit_once: True
resource: 'https://my.loseit.com/login'
input:
email: !secret LoseIt_username
password: !secret LoseIt_password
sensor:
- unique_id: calories_remaining
name: Calories Remaining
select: "#applicationPanel > div > div > div.GCJ-IGUNGC > div > table > tbody > tr:nth-child(3) > td > table > tbody > tr > td:nth-child(2) > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(2) > td > div > div > table > tbody > tr:nth-child(3) > td > table > tbody > tr > td > div > strong"
And this is the debug log:
2024-01-31 16:14:34.344 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration multiscrape which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-01-31 16:14:44.652 ERROR (MainThread) [custom_components.multiscrape.coordinator] Scraper McScrapeface # Exception in form-submit feature. Will continue trying to scrape target page.
Client error '405 Method Not Allowed' for url 'https://my.loseit.com/login'
For more information check: https://httpstatuses.com/405
2024-01-31 16:14:45.492 ERROR (MainThread) [custom_components.multiscrape.sensor] Scraper McScrapeface # Calories Remaining # Unable to scrape data: Could not find a tag for given selector
Consider using debug logging and log_response for further investigation.
I went down a rabbit hole of headers, I’m not 100% sure what I was looking at but that could be a source of the problem.
I’m running Home Assistant v2023.9.3 on a Windows VirtualBox virtual machine.
Thanks in advance if you see this and know what’s up.
Use the log_response option as documented in the multiscrape docs to see what the server response is, and then post it here. Perhaps you just need to change the method from GET to POST.
Do you mind sharing your yaml code from what you ended up learning? I am heading down this path and if someone has already invented the wheel . . . Many thanks!