facebook-scraper icon indicating copy to clipboard operation
facebook-scraper copied to clipboard

Unwanted Output with Linux

Open Spountil opened this issue 3 years ago • 8 comments

Hello,

First of all, thank you for this very useful package!

I started to use this on Linux and the dictionnary output was far from what I have while using Windows. On windows, all is working well and ready to be used, but in Linux, I get a lot more characters and information not understandable.

Both results below comes from the same code on different machines. Could you help me understand why the Linux one is not working properly?

I'm quite new to Linux and don't really understand how this could happen.

Here are examples:

This is the output I have on windows:

{'post_id': '5031126060251326', 'text': "Les nageurs de l'Academie Philippe Croizon se lancent un nouveau défi... en Polynésie.", 'post_text': "Les nageurs de l'Academie Philippe Croizon se lancent un nouveau défi... en Polynésie.", 'shared_text': '', 'time': '2021-11-28 23:30:26', 'timestamp': None, 'image': None, 'image_lowquality': 'https://scontent.fvlc6-2.fna.fbcdn.net/v/t15.5256-10/cp0/e15/q65/s320x320/260191413_2882793695365879_7246843703237584550_n.jpg?_nc_cat=103&ccb=1-5&_nc_sid=ccf8b3&efg=eyJpIjoidCJ9&_nc_ohc=oAKDFd9V6GMAX-RMbNQ&_nc_ht=scontent.fvlc6-2.fna&oh=6b08a21bcddb58287c17e4482260fe2c&oe=61A9E0FE', 'images': [], 'images_description': [], 'images_lowquality': ['https://scontent.fvlc6-2.fna.fbcdn.net/v/t15.5256-10/cp0/e15/q65/s320x320/260191413_2882793695365879_7246843703237584550_n.jpg?_nc_cat=103&ccb=1-5&_nc_sid=ccf8b3&efg=eyJpIjoidCJ9&_nc_ohc=oAKDFd9V6GMAX-RMbNQ&_nc_ht=scontent.fvlc6-2.fna&oh=6b08a21bcddb58287c17e4482260fe2c&oe=61A9E0FE'], 'images_lowquality_description': [None], 'video': 'https://video.fvlc6-1.fna.fbcdn.net/v/t42.1790-2/261167821_424272259185561_9218314070139776805_n.mp4?_nc_cat=109&ccb=1-5&_nc_sid=985c63&efg=eyJ2ZW5jb2RlX3RhZyI6InN2ZV9zZCJ9&_nc_ohc=C35pTQiHrgMAX8aTt6m&_nc_oc=AQmyeO8R4qDGVvVYS4MDy0wHUcrMCaKWZ4M2b8ciwyY43BYm4T2m7wmfNPo24O50TuE&_nc_rml=0&_nc_ht=video.fvlc6-1.fna&oh=b060ff86f5a39a7ac457925bc3773915&oe=61A4309A', 'video_duration_seconds': None, 'video_height': None, 'video_id': '2882792615365987', 'video_quality': None, 'video_size_MB': None, 'video_thumbnail': 'https://scontent.fvlc6-2.fna.fbcdn.net/v/t15.5256-10/cp0/e15/q65/s320x320/260191413_2882793695365879_7246843703237584550_n.jpg?_nc_cat=103&ccb=1-5&_nc_sid=ccf8b3&efg=eyJpIjoidCJ9&_nc_ohc=oAKDFd9V6GMAX-RMbNQ&_nc_ht=scontent.fvlc6-2.fna&oh=6b08a21bcddb58287c17e4482260fe2c&oe=61A9E0FE', 'video_watches': None, 'video_width': None, 'likes': None, 'comments': 0, 'shares': 2, 'post_url': 'https://facebook.com/TahitiNuiTelevision/posts/5031126060251326', 'link': None, 'links': [], 'user_id': '118052958225352', 'username': 'TNTV Tahiti Nui Télévision', 'user_url': 'https://facebook.com/TahitiNuiTelevision/?__tn__=C-R', 'is_live': False, 'factcheck': None, 'shared_post_id': None, 'shared_time': None, 'shared_user_id': None, 'shared_username': None, 'shared_post_url': None, 'available': True, 'comments_full': [], 'reactors': [{'name': 'Aavs Frederic Landry', 'link': 'https://facebook.com/aavs.fredericlandry?fref=pb', 'type': 'j’aime'}, {'name': 'Maeva Cadousteau', 'link': 'https://facebook.com/profile.php?id=100009108448417&fref=pb', 'type': 'solidaire'}, {'name': 'David le Thiec', 'link': 'https://facebook.com/david.lethiec.9?fref=pb', 'type': 'j’aime'}, {'name': 'Mareva Teoroi', 'link': 'https://facebook.com/mareva.teoroi?fref=pb', 'type': 'j’adore'}, {'name': 'Holly Etera Kaimuko Mai', 'link': 'https://facebook.com/hollyeteram?fref=pb', 'type': 'j’aime'}, {'name': 'Christel Martin Borie', 'link': 'https://facebook.com/LaSmalaMartinBorie?fref=pb', 'type': 'j’aime'}], 'w3_fb_url': 'https://www.facebook.com/TahitiNuiTelevision/posts/5031126060251326', 'reactions': {'j’aime': 4, 'j’adore': 1, 'solidaire': 1}, 'reaction_count': 6, 'with': None, 'page_id': '118052958225352', 'sharers': None, 'image_id': None, 'image_ids': [], 'was_live': False, 'fetched_time': '2021-11-28 23:48:29.818330'}

When I use the same code on Linux, I get the following (this is a sample since it is quite long):

{'post_id': 5031126060251326, 'text': 'Les nageurs de l\'Académie Philippe Croizon se lancent un nouveau défi... en Polynésie.\nLire la vidéo\nJ’aime\nJ’adore\nSolidaire\n6\n2 Shares\nLike\nShow more reactions\nComment\nShare\nLoading...\nTry Again\nCancel\nLoading...\nLoading...\nMPageLoadClientMetrics.logFirstPaint(true);requireLazy(["HasteSupportData"],function(m){m.handle({"gkxData":{"5241":{"result":false,"hash":"AT7o1bCQPGpf3ShECnA"},"676920":{"result":false,"hash":"AT497IX4gOFG8gZeGvs"},"708253":{"result":false,"hash":"AT5n4hBL3YTMnQWtP1M"},"996940":{"result":false,"hash":"AT7opYuEGy3sjG1aHz4"},"1263340":{"result":false,"hash":"AT5bwizWgDaFQudmsCA"}}})});requireLazy(["TimeSliceImpl","ServerJS"],function(TimeSlice,ServerJS){(new ServerJS()).handle({"define":[["CometPersistQueryParams",[],{"relative":{},"domain":{}},6231],["BigPipeExperiments",[],{"link_images_to_pagelets":false,"enable_bigpipe_plugins":false},907],["BootloaderConfig",[],{"deferBootloads":false,"jsRetries":[200,500],"jsRetryAbortNum":2,"jsRetryAbortTime":5,"silentDups":false,"hypStep4":false,"phdOn":false},329],["CSSLoaderConfig",[],{"timeout":5000,"modulePrefix":"BLCSS:","loadEventSupported":true},619],["CurrentCommunityInitialData",[],{},490],["CurrentUserInitialData",[],{"ACCOUNT_ID":"1041074630","USER_ID":"1041074630","NAME":"Ramana Al Wardi","SHORT_NAME":"Ramana","IS_BUSINESS_PERSON_ACCOUNT":false,"HAS_SECONDARY_BUSINESS_PERSON":false,"IS_FACEBOOK_WORK_ACCOUNT":false,"IS_MESSENGER_ONLY_USER":false,"IS_DEACTIVATED_ALLOWED_ON_MESSENGER":false,"IS_MESSENGER_CALL_GUEST_USER":false,"IS_WORK_MESSENGER_CALL_GUEST_USER":false,"APP_ID":"412378670482","IS_BUSINESS_DOMAIN":false},270],["ErrorDebugHooks",[],{"SnapShotHook":null},185],["ISB",[],{},330],["LSD",[],{"token":"SBBN3QerjMCpgaqT5m6oyf"},323],["MRequestConfig",[],{"dtsg":{"token":"AQEgxxdqLUj2Neg:19:1637078502","valid_for":86400,"expire":1638225935},"dtsg_ag":{"token":"AQw3TPSvM0gHqHHRDXDTuAxDwFQ5v36YxsyoP-Te2OybL8H4:19:1637078502","valid_for":604800,"expire":1638744335},"checkResponseOrigin":true,"checkResponseToken":true,"cleanFinishedRequest":false,"cleanFinishedPrefetchRequests":true,"ajaxResponseToken":{"secret":"6RjTQE52oAwJFo8bNXxvd21qfPwBOuCf","encrypted":"AYlsV3ZsEAkJ-4Tns9nnr4p2ryNLDodxDocQmkTZkv8b0GkoxFSqrpeMF1n-xAIhVPBVipTDFMwV5iWO6HV4ajbGrpjeUlgRzUSeYa8EBmknZA"}},51],["ServerNonce",[],{"ServerNonce":"D2pBNdClSnqUEMsYLgtYrL"},141],["SiteData",[],{"server_revision":1004773016,"client_revision":1004773016,"tier":"","push_phase":"C3","pkg_cohort":"BP:mtouch_pkg","haste_session":"18959.BP:mtouch_pkg.2.0.0.0.","pr":1,"haste_site":"mobile","be_one_ahead":false,"ir_on":true,"is_rtl":false,"is_comet":false,"is_experimental_tier":false,"is_jit_warmed_up":true,"hsi":"7035755730853324421-0","semr_host_bucket":"6","bl_hash_version":2,"skip_rd_bl":true,"comet_env":0,"spin":0,"__spin_r":1004773016,"__spin_b":"trunk","__spin_t":1638139534,"vip":"31.13.83.36"},317],["SprinkleConfig",[],{"param_name":"jazoest","version":2,"should_randomize":false},2111],["PromiseUsePolyfillSetImmediateGK",[],{"www_always_use_polyfill_setimmediate":false},2190],["KSConfig",[],{"killed":{"__set":["MOBILIZER_SELF_SERVE_OWNERSHIP_RESOLVER","MLHUB_FLOW_AUTOREFRESH_SEARCH","NEKO_DISABLE_CREATE_FOR_SAP","EO_DISABLE_SYSTEM_SERIAL_NUMBER_FREE_TYPING_IN_CPE_NON_CLIENT","MOBILITY_KILL_OLD_VISIBILITY_POSITION_SETTING","WORKPLACE_DISPLAY_TEXT_EVIDENCE_REPORTING","BUSINESS_INVITE_FLOW_WITH_SELLER_PROFILE","BUY_AT_UI_LINE_DELETE","BUSINESS_GRAPH_SETTING_APP_ASSIGNED_USERS_NEW_API","BUSINESS_GRAPH_SETTING_BU_ASSIGNED_USERS_NEW_API","BUSINESS_GRAPH_SETTING_ESG_ASSIGNED_USERS_NEW_API","BUSINESS_GRAPH_SETTING_PRODUCT_CATALOG_ASSIGNED_USERS_NEW_API","BUSINESS_GRAPH_SETTING_SESG_ASSIGNED_USERS_NEW_API","BUSINESS_GRAPH_SETTING_WABA_ASSIGNED_USERS_NEW_API","ADS_PLACEMENT_FIX_PUBLISHER_PLATFORMS_MUTATION","FORCE_FETCH_BOOSTED_COMPONENT_AFTER_ADS_CREATION","VIDEO_DIMENSIONS_FROM_PLAYER_IN_UPLOAD_DIALOG","SNIVY_GROUP_BY_EVENT_TRACE_ID_AND_NAME","ADS_STORE_VISITS_METRICS_DEPRECATION","DYNAMIC_ADS_SET_CATALOG_AND_PRODUCT_SET_TOGETHER","AD_DRAFT_ENABLE_SYNCRHONOUS_FRAGMENT_VALIDATION","NEKO_ENABLE_RESET_SAP_FOR_CREATE_AD_SET_CONTEXTUAL","SEPARATE_MESSAGING_COMACTIVITY_PAGE_PERMS","LAB_NET_NEW_UI_RELEASE","POCKET_MONSTERS_CREATE","POCKET_MONSTERS_DELETE","SRT_BANZAI_SRT_CORE_LOGGER","SRT_BANZAI_SRT_MAIN_LOGGER","WORKPLACE_PLATFORM_SECURE_APPS_MAILBOXES","POCKET_MONSTERS_UPDATE_NAME","IC_DISABLE_MERGE_TOOL_FEED_CHECK_FOR_REPLACE_SCHEDULE","ADS_EPD_IMPACTED_ADVERTISER_MIGRATE_XCONTROLLER","RECRUITING_CANDIDATE_PORTAL_ACCOUNT_DELETION_CARD"]},"ko":{"__set":["8H4bQmEiuLT","3OsLvnSHNTt","1G7wJ6bJt9K","9NpkGYwzrPG","3oh5Mw86USj","8NAceEy9JZo","7FOIzos6XJX","rf8JEPGgOi","4j36SVzvP3w","4NSq3ZC4ScE","53gCxKq281G","3yzzwBY7Npj","1onzIv0jH6H","8PlKuowafe8","1ntjZ2zgf03","4SIH2GRVX5W","2dhqRnqXGLQ","2WgiNOrHVuC","amKHb4Cw4WI","5mNEXob0nTj","8rDvN9vWdAK","9cL5o2kjfZo","5BdzWGmfvrA","DDZhogI19W","acrJTh9WGdp","1oOE64fL4wO","9Gd8qgRxn8z","MPMaqnqZ9c","5XCz1h9Iaw3","7r6mSP7ofr2","6DGPLrRdyts","aWxCyi1sEC7","9kCSDzzr8fu"]}},2580],["ImmediateImplementationExperiments",[],{"prefer_message_channel":true},3419],["UriNeedRawQuerySVConfig",[],{"uris":["dms.netmng.com","doubleclick.net","r.msn.com","watchit.sky.com","graphite.instagram.com","www.kfc.co.th","learn.pantheon.io","www.landmarkshops.in","www.ncl.com","s0.wp.com","www.tatacliq.com","bs.serving-sys.com","kohls.com","lazada.co.th","xg4ken.com","technopark.ru","officedepot.com.mx","bestbuy.com.mx","booking.com","nibio.no"]},3871],["RunGatingConfig",[],{"shouldUseBrowserUnload":true},3914],["InitialCookieConsent",[],{"deferCookies":false,"initialConsent":{"__set":[1,2]},"noCookies":false,"shouldShowCookieBanner":false},4328],["TrustedTypesConfig",[],{"useTrustedTypes":false,"reportOnly":false},4548],["WebConnectionClassServerGuess",[],{"connectionClass":"EXCELLENT"},4705],["BootloaderEndpointConfig",[],{"debugNoBatching":false,"endpointURI":"https:\\/\\/m.facebook.com\\/ajax\\/bootloader-endpoint\\/"},5094],["CookieConsentIFrameConfig",[],{"consent_param":"FQAREREA.ARZDFD5q-hLUGr3J4zxpPhA1jPyShHa-MwAeGJMM5tO3G6LU","allowlisted_iframes":[]},5540],["JSErrorLoggingConfig",[],{"appId":412378670482,"extra":[],"reportInterval":50,"sampleWeight":null,"sampleWeightKey":"__jssesw"},2776],["cr:696703",[],{"__rc":[null,"Aa1aOHgW15X1LdDxla3RT95MV2j0pNtSZiKvalp6pGP2_bel2ItbEp4J5z8N3VjOBOBtClYgd2j6-r2f6ZYpiYKPZzM"]},-1],["cr:717822",["TimeSliceImpl"],{"__rc":["TimeSliceImpl","Aa1aOHgW15X1LdDxla3RT95MV2j0pNtSZiKvalp6pGP2_bel2ItbEp4J5z8N3VjOBOBtClYgd2j6-r2f6ZYpiYKPZzM"]},-1],["cr:729414",[],{"__rc":[null,"Aa19p2WhGti2LpoTVPbEbypyCJGmDLEwwSeAyywyQYw7vOG7br0d8ZDO6EZfZAZ-E90GLi75n5KEAjrRSeDm8dCr"]},-1]],"require":[["MPrelude"],["VisualCompletionGating"],["RequireDeferredReference","unblock",[],[["VisualCompletionGating"],"sd"]],["RequireDeferredReference","unblock",[],[["VisualCompletionGating"],"css"]]]});}); now_inl=(function(){var p=window.performance;return p&&p.now&&p.timing&&p.timing.navigationStart?function(){return p.now()+p.timing.navigationStart}:function(){return new Date().getTime()};})();window.__bigPipeFR=now_inl();\nwindow.__bigPipeCtor=now_inl();requireLazy(["BigPipe"],function(BigPipe){define("__bigPipe",[],window.bigPipe=new BigPipe({"forceFinish":true,"config"

Best regards, Spountil

Spountil avatar Nov 28 '21 23:11 Spountil

This sounds similar to https://github.com/kevinzg/facebook-scraper/issues/563#issuecomment-981148433. Are you passing cookies? Do you get any locale warnings?

neon-ninja avatar Nov 28 '21 23:11 neon-ninja

Yes, I use the same json file for both for the cookies. I'm not having any warnings but I'm using it in a function. I'll try later to use it outside of the function to see if there is any warning

Spountil avatar Nov 29 '21 00:11 Spountil

It looks like your Facebook language is set to French, try set it to English and see if that solves the problem

neon-ninja avatar Nov 29 '21 02:11 neon-ninja

Sorry I did not reply earlier but my Linux machine was not reachable anymore (I use Google Cloud)... I'm setting it up again and let you know how it turns out

Spountil avatar Nov 29 '21 21:11 Spountil

I found a work around the problem: I was using Linux Debian and tried with Ubuntu and it works!

Spountil avatar Nov 29 '21 23:11 Spountil

I have the same issue using a Mac M1 machine. I set the language to English. How can I solve it?

emmanuelasso avatar Feb 21 '22 16:02 emmanuelasso

Try pip install -U lxml

neon-ninja avatar Feb 21 '22 17:02 neon-ninja

Try pip install -U lxml

Hi. I tried but it still not working. Later, I tried https://github.com/kevinzg/facebook-scraper/issues/563#issuecomment-973257009 and finally works!

emmanuelasso avatar Feb 21 '22 19:02 emmanuelasso