facebook_page_scraper icon indicating copy to clipboard operation
facebook_page_scraper copied to clipboard

Getting Data of META AI

Open urooj471 opened this issue 1 year ago • 16 comments

I am changing page name but still I am getting data of META AI. Could you please resolve this issue.

urooj471 avatar Sep 22 '22 14:09 urooj471

Do you mind sharing that code snippet which you tried?

shaikhsajid1111 avatar Sep 22 '22 14:09 shaikhsajid1111

from facebook_page_scraper import Facebook_scraper page_name = "JoiyaMamaSundaNahi" posts_count = 10 meta_ai = Facebook_scraper(page_name, posts_count) json_data = meta_ai.scrap_to_json()

urooj471 avatar Sep 22 '22 15:09 urooj471

I have shared the code in the comment. Please check.

urooj471 avatar Sep 22 '22 15:09 urooj471

Any update on the above issue?

urooj471 avatar Sep 23 '22 07:09 urooj471

There was an issue that a few selectors were outdated and the crawler was throwing an error that no posts were found. But there wasn't any issue found regarding the same data getting returned. I even tried your provided Facebook page name and got the result, Hope you're not checking some old data because of any way you were not getting any data for the last few days. I will push the fix in the next couple of hours. Let me know if the released changes fix things.

shaikhsajid1111 avatar Sep 23 '22 13:09 shaikhsajid1111

When I am trying code in different consoles then different data is coming. But in the same console when I am changing the page name then previous page data is coming. Please look into it

urooj471 avatar Sep 24 '22 11:09 urooj471

I don't find any issue with that as the library is doing what it intends to. I don't know what you're trying, what kind of environment you're trying in. I've got no reports as such

shaikhsajid1111 avatar Sep 25 '22 08:09 shaikhsajid1111

I am trying in spyder. To get the data of different page I need to restart the console everytime.

urooj471 avatar Sep 25 '22 08:09 urooj471

You may check the line of code which changes the page name argument of the scraper. Because If the library works for any page apart from just Meta AI, that's no problem from the library's end but probably how your code is working.

shaikhsajid1111 avatar Sep 25 '22 13:09 shaikhsajid1111

The code which I shared with you in comments. If I am changing page name then it is giving me prevoius page data.

urooj471 avatar Sep 25 '22 17:09 urooj471

could you please tell what mistake i am doing

urooj471 avatar Sep 25 '22 17:09 urooj471

Your above code just stores the output into the json_data variable, you're not even printing that variable's content than how come your code is saving the data?, You can't even save the data using redirection operator if you're not printing anything neither you're saving it to json file. How are you saving the output than?

shaikhsajid1111 avatar Sep 25 '22 17:09 shaikhsajid1111

Again I am putting the issue. page_name = "metaai" posts_count = 10 meta_ai = Facebook_scraper(page_name, posts_count) meta_ai.scrap_to_csv("metaai","D:/Scraped Data/Facebook")

page_name = "Cricinfo" posts_count = 10 meta_ai = Facebook_scraper(page_name, posts_count) meta_ai.scrap_to_csv("cricinfo","D:/Scraped Data/Facebook")

With above codes I should be getting information of two different page. But I am getting information of one in both the files. I am attaching output of both the codes. cricinfo.csv metaai.csv

urooj471 avatar Sep 25 '22 18:09 urooj471

Yeah, that's expected. Because this method write output in write mode, which erases the previous content of the file. If you write two output in same file, you will get the output of the most recent one as the previous data will be erased. If you want to write multiple page's data into a single file you probably should obtain data in JSON format and convert it to CSV, write it to file.

shaikhsajid1111 avatar Sep 26 '22 09:09 shaikhsajid1111

What changes i should make in my code. Could you please change in my code and send it to me.

urooj471 avatar Sep 26 '22 11:09 urooj471

You can take reference from this method, just skip the row header part, and open file in append mode instead of write mode.

Apology I couldn't provide you the code directly, I'm not much available these days.

shaikhsajid1111 avatar Sep 26 '22 18:09 shaikhsajid1111