Closed kbzowski closed 3 years ago
Please attach configuration if modified.
Also which website is giving you this error, main or mbasic?
Is the requested page a profile, group or a page?
Was the script working before? I have encountered this error with profiles using mbasic website and the reason was Facebook temporarily ban.
USE_KEY=False # Use secret key for API requests. Enable this if you want and fill API_KEY below.
API_KEY=""
# Playwright Browser Connection
PROXY_SERVER="" # Supports http and socks proxies. e.g. http://myproxy.com:3128 or socks5://myproxy.com:3128
PROXY_USERNAME=""
PROXY_PASSWORD=""
# Facebook related settings
LANGUAGE_CODE="en" # Supports EN only currently.
SITE="mbasic" # choices=['main', 'mobile', 'mbasic']
USE_ACCOUNT=True # Set this to "with_account" or "without_account"
EXPIRATION_TIME=30 # Time in minutes for cached feeds to expire after
page: /page/piwapodwiaduktem It was working when we added Docker. Today I pull latest changes and it stopped. After short investigation I think it can be caused by https://github.com/yshalsager/facebook2rss/issues/18 because after short investigation I saw the same error when i tried to login once again.
I have setup that today with Docker and my first tries failed.
Don't know if it worked before, but here are the groups name I was trying: ProgramistaNaSwoim
and homeassistantpolska
I will add some more debug logging since I think this is caused my Facebook mbasic website temporarily ban.
I am busy nowadays that's why I am unable to check.
BTW you may try change the site variable in config to "main" and see if the problem still exists.
I've change it to main
and now have this:
2021-03-18 08:02:22,186 [INFO] uvicorn.error [server.serve:64]: Started server process [6]
2021-03-18 08:02:22,189 [INFO] uvicorn.error [on.startup:26]: Waiting for application startup.
2021-03-18 08:02:22,190 [INFO] fastapi [main.startup_event:44]: Performing startup tasks...
2021-03-18 08:02:22,191 [INFO] fastapi [main.startup_event:47]: Login cookies file was not found, setting working mode to no account!
2021-03-18 08:02:22,191 [INFO] uvicorn.error [on.startup:38]: Application startup complete.
2021-03-18 08:02:22,198 [INFO] uvicorn.error [server._log_started_message:199]: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2021-03-18 08:02:25,963 [INFO] uvicorn.access [httptools_impl.send:463]: 192.168.0.100:1846 - "GET /docs HTTP/1.1" 200
2021-03-18 08:02:26,161 [INFO] uvicorn.access [httptools_impl.send:463]: 192.168.0.100:1846 - "GET /openapi.json HTTP/1.1" 200
2021-03-18 08:02:54,225 [INFO] browser [browser.get_browser:61]: Browser launched with saved cookies.
2021-03-18 08:02:54,250 [INFO] cache [decorators.wrapper:21]: No valid cached feed found for homeassistantpolska, getting a new feed...
2021-03-18 08:02:57,620 [INFO] uvicorn.access [httptools_impl.send:463]: 192.168.0.100:1848 - "GET /group/homeassistantpolska?full=0&no_cache=0&limit=0&as_text=0&comments=0 HTTP/1.1" 403
2021-03-18 08:02:57,691 [INFO] browser [browser.get_browser:69]: Browser shutdown.
Swagger:
{
"detail": "You cannot access Facebook profiles without enabling USE_ACCOUNT option and logged in."
}
Uncomment python3 -m facebook_rss --login -u $EMAIL -p $PASSWORD
in start.sh
Set env variables: EMAIL and PASSWORD or change it directly in start.sh
I will try to propose PR with more straightforward approach soon because for now app requires additional steps for login which can be confusing.
@kbzowski thanks for the hint.
Here is what I end up, it seem can't find the email field:
2021-03-18 10:57:49,298 [INFO] uvicorn.error [on.startup:38]: Application startup complete.
2021-03-18 10:57:49,309 [INFO] uvicorn.error [server._log_started_message:199]: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2021-03-18 10:57:49,444 [INFO] uvicorn.access [httptools_impl.send:463]: 192.168.0.100:4227 - "GET /docs HTTP/1.1" 200
2021-03-18 10:57:49,575 [INFO] uvicorn.access [httptools_impl.send:463]: 192.168.0.100:4227 - "GET /openapi.json HTTP/1.1" 200
2021-03-18 10:58:00,971 [INFO] browser [browser.get_browser:61]: Browser launched with saved cookies.
2021-03-18 10:58:00,996 [INFO] cache [decorators.wrapper:21]: No valid cached feed found for homeassistantpolska, getting a new feed...
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/facebook2rss/facebook_rss/__main__.py", line 23, in <module>
asyncio.run(login_and_get_cookies(args.email, args.password))
File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/opt/facebook2rss/facebook_rss/tasks/login.py", line 18, in login_and_get_cookies
logged_in = await login_page.login(user, password)
File "/opt/facebook2rss/facebook_rss/browser/common/login.py", line 30, in login
await self.page.fill(self.email, email)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/async_api/_generated.py", line 7414, in fill
raise e
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/async_api/_generated.py", line 7403, in fill
await self._impl_obj.fill(
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/_impl/_page.py", line 636, in fill
return await self._main_frame.fill(**locals_to_params(locals()))
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/_impl/_frame.py", line 414, in fill
await self._channel.send("fill", locals_to_params(locals()))
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/_impl/_connection.py", line 36, in send
return await self.inner_send(method, params, False)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/_impl/_connection.py", line 47, in inner_send
result = await callback.future
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for selector "//input[@name="email"]"
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.
2021-03-18 10:58:32,848 [INFO] uvicorn.access [httptools_impl.send:463]: 192.168.0.100:4231 - "GET /page/homeassistantpolska?full=0&no_cache=0&limit=0&as_text=0&comments=0 HTTP/1.1" 500
2021-03-18 10:58:32,945 [INFO] browser [browser.get_browser:69]: Browser shutdown.
2021-03-18 10:58:32,946 [ERROR] uvicorn.error [httptools_impl.run_asgi:401]: Exception in ASGI application
Traceback (most recent call last):
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 398, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/uvicorn/middleware/message_logger.py", line 65, in __call__
raise exc from None
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/uvicorn/middleware/message_logger.py", line 61, in __call__
await self.app(scope, inner_receive, inner_send)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/fastapi/applications.py", line 199, in __call__
await super().__call__(scope, receive, send)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
await self.middleware_stack(scope, receive, send)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
response = await func(request)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/fastapi/routing.py", line 201, in app
raw_response = await run_endpoint_function(
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/fastapi/routing.py", line 148, in run_endpoint_function
return await dependant.call(**values)
File "./facebook_rss/utils/decorators.py", line 50, in wrapper
value = await func(*args, **kwargs)
File "./facebook_rss/utils/decorators.py", line 22, in wrapper
value = await func(*args, **kwargs)
File "./facebook_rss/routes/page.py", line 29, in get_page
_page = await pages[site]["page"].create(page, fb_page)
File "./facebook_rss/browser/main/page.py", line 16, in create
await self.open(self.url)
File "./facebook_rss/browser/common/base_page.py", line 33, in open
await self.page.wait_for_selector('body')
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/async_api/_generated.py", line 5674, in wait_for_selector
raise e
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/async_api/_generated.py", line 5666, in wait_for_selector
await self._impl_obj.wait_for_selector(
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/_impl/_page.py", line 353, in wait_for_selector
return await self._main_frame.wait_for_selector(**locals_to_params(locals()))
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/_impl/_frame.py", line 250, in wait_for_selector
await self._channel.send("waitForSelector", locals_to_params(locals()))
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/_impl/_connection.py", line 36, in send
return await self.inner_send(method, params, False)
File "/opt/facebook2rss/.venv/lib/python3.8/site-packages/playwright/_impl/_connection.py", line 47, in inner_send
result = await callback.future
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for selector "body" to be visible
selector resolved to hidden <body dir="ltr" class="fbx UIPage_LoggedOut hasBanner …>…</body>
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.
Built and run from Docker on Linux.