shaikhsajid1111 / facebook_page_scraper

Scrapes facebook's pages front end with no limitations & provides a feature to turn data into structured JSON or CSV
https://pypi.org/project/facebook-page-scraper/
MIT License
222 stars 67 forks source link

When I run the script I am getting this : error at find_elements method : invalid literal for int() with base 10: '' #26

Closed izzyjere closed 2 years ago

izzyjere commented 2 years ago

it works now

LChito commented 2 years ago

Hello @izzyjere how do you resolve the problem. When i run the script im still getting the error. Also @shaikhsajid1111 there some pages im still having "No posts were found!". Please let me now how can I fix these two problems.

Thx!

shaikhsajid1111 commented 2 years ago

@LChito do you mind sharing one of those pages so I can recreate the issue?

LChito commented 2 years ago

@shaikhsajid1111 Hello, sorry for the late. This 2 pages I used that show me that problems:

shaikhsajid1111 commented 1 year ago

Hey, I've checked the issue.

  1. https://www.facebook.com/brasil.farmacias - This Page isn't available. image
  2. https://www.facebook.com/FarmaciasSanRafaelYLibreriasMarcela - Yeah selector was outdated, I've fixed this as well and will push an update in a couple of hours.

If you're having an issue with this scraper, consider running that page in headful mode by passing headless=False in the constructor of Facebook_scraper. Like so, crawler = Facebook_scraper("FarmaciasSanRafaelYLibreriasMarcela", posts_count=10, browser="firefox",headless=False)

LChito commented 1 year ago

Sorry @shaikhsajid1111 can you show me how I have to put this code on Python. Also, I have to update the version in my repository?

shaikhsajid1111 commented 1 year ago

Just pass headless=False in the Facebook_scraper like I have mentioned in the code above. While running the code the browser window wil open and you can see what's really happening. Example:

crawler = Facebook_scraper("FarmaciasSanRafaelYLibreriasMarcela", posts_count=10, browser="firefox",headless=False)
data = crawler.scrap_to_json()
print(data)

BTW, are you using different Facebook language?, This crawler shall work with English(UK)

LChito commented 1 year ago

@shaikhsajid1111 Maybe it continue happen because I have the facebook in Spanish. How can I change de language? Ejemplo

shaikhsajid1111 commented 1 year ago

https://www.facebook.com/help/327850733950290/manage-your-facebook-language-settings/?helpref=platform_switcher&cms_platform=www

I think this may help 😅

LChito commented 1 year ago

I'm still having the problem 😞 were do you download th firefox driver? Because I'm using Chormedriver

shaikhsajid1111 commented 1 year ago

Logs are still same like the one you posted screenshot above?, I mean I changed logs format but in your screenshot shows still the old format

LChito commented 1 year ago

@shaikhsajid1111 can you show me? Because I really don't undertstand you right now, im sorry 😢

shaikhsajid1111 commented 1 year ago

When you run the crawler, is it still printing the same thing in same format?, Or the format looks different?

LChito commented 1 year ago

It's the same one

shaikhsajid1111 commented 1 year ago

I have couple of reasons why it may not be working,

  1. Code is still the old one, it's not updated. You need to update the code first. Use pip to install latest one, it will be easier, just use the command pip3 install facebook-page-scraper
  2. Your language is stil Spanish, you might have changed it on your browser but when it creates a new browser profile it still runs in Spanish.
LChito commented 1 year ago

What's the newest version to install?

shaikhsajid1111 commented 1 year ago

You can refer this https://pypi.org/project/facebook-page-scraper/4.0.0/

LChito commented 1 year ago

THANK YOU SO MUCH! Finally it works! Only the reactions doesn't works properly.

shaikhsajid1111 commented 1 year ago

Reactions might not be working because it finds reaction by keywords like "50 Cares", so If it's not in English you will get 0 as the output. That's the very reason I was suggesting to use English

LChito commented 1 year ago

@shaikhsajid1111 I already change de language to English UK in my facebook like the personal but in the scrapper I continue looking it in spanish, what changes I have to do?

shaikhsajid1111 commented 1 year ago

It is happening probably because of the region. I even face the same issue, I fix it by inserting en-gb at the prefix of the link so it look something like this https://en-gb.facebook.com/