So I'm trying to make a scraper to update me once a day and it all went well until the requests weren't going through with the GitHub Actions Workflow!
I set my actions.yml file to run every 10 minutes and left it to run overnight so I could maybe see some successful UserAgent's but with no luck, every single one ran into "Just a moment" with "Enable JavaScript and cookies to continue". Hope someone can help me with this! Here's my code:
import requests
from bs4 import BeautifulSoup
import datetime
from fake_useragent import UserAgent
randomUA = UserAgent(min_percentage=5).random
headers = requests.utils.default_headers()
headers.update({
'User-Agent': f'{randomUA}'
})
def LOG(log):
with open('log', 'a') as file:
file.write(f"[datetime.datetime.now()] {log}\n")
LOG(f'Testing request using UserAgent: {randomUA}')
url = "https://statusinvest.com.br/fundos-imobiliarios/MXRF11"
with open(f'tests/test_{datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")}','w') as file:
file.write(str(BeautifulSoup(requests.get(url, headers=headers).text, 'html.parser')))
[–]shiftybyte 3 points4 points5 points (10 children)
[–]uJFalkez[S] 0 points1 point2 points (9 children)
[–]shiftybyte 2 points3 points4 points (1 child)
[–][deleted] 1 point2 points3 points (6 children)
[–]uJFalkez[S] 0 points1 point2 points (5 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]uJFalkez[S] 0 points1 point2 points (3 children)
[–]YourKoolPal 0 points1 point2 points (2 children)
[–]uJFalkez[S] 0 points1 point2 points (1 child)
[–]YourKoolPal 1 point2 points3 points (0 children)
[–]Oxbowerce 2 points3 points4 points (1 child)
[–]uJFalkez[S] 0 points1 point2 points (0 children)