furas

Python - find JSON in JavaScript string and search values - (Stackoverflow)

Mar 6th, 2022 (edited)
256
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # https://stackoverflow.com/questions/71355922/how-can-i-scrape-json-string-inside-a-javascript-function-using-beautifulsoup4
  2.  
  3. import json
  4. import pprint as pp
  5.  
  6. # --- text from `<script></script>` ---
  7. text = '''requireLazy(["HasteSupportData"],function(m){m.handle({"ixData":{"514465":{"sprited":2,"spi":"https:\/\/static.xx.fbcdn.net\/rsrc.php\/v3\/yi\/r\/L1BsKUBrBox.png","w":24,"h":24,"p":"0 -977px","sz":"auto"}}})});requireLazy(["Bootloader"],function(m){m.handlePayload({"consistency":{"rev":1005155550},"rsrcTags":["u_0_0_Fh","u_0_1_Cq"]})});
  8. requireLazy(["CometResourceScheduler"],function(c){c.registerHighPriHashes(["cqSX+IP","3UlWeYE"])});
  9. requireLazy(["JSScheduler","ServerJS","ScheduledApplyEach"],function(JSScheduler,ServerJS,ScheduledApplyEach){JSScheduler.runWithPriority(3,function(){(new ServerJS()).handleWithCustomApplyEach(ScheduledApplyEach,{"require":[["FacebookHelpCenterHomeContent_content$normalization.graphql"],["FacebookHelpCenterHomeContent.react"],["emptyFunction","thatReturns",["RequireDeferredReference"],[[{"__dr":"FacebookHelpCenterHomeContent_content$normalization.graphql"},{"__dr":"FacebookHelpCenterHomeContent.react"}]]],["RelayPrefetchedStreamCache","next",[],["adp_HelpCenterHomePageRootQueryRelayPreloader_622541c89b4d78672816911",{"__bbox":{"complete":true,"result":{"data":{"config":{"__typename":"FacebookHelpCenter","sessionID":"0NYVn9QEHBKzHO21d","__isHelpCenter":"FacebookHelpCenter","errorInstance":{"__typename":"HelpCenterErrorConfigBase","__isHelpCenterErrorConfig":"HelpCenterErrorConfigBase","error_config":{"platformLink":"https:\/\/www.facebook.com"}},"navigationInstance":{"__typename":"HelpCenterNavigationBase","__isHelpCenterNavigation":"HelpCenterNavigationBase","navigation_root_id":"463972400461409","navigation":{"children":[{"__typename":"HelpCenterNavigationFolder","isNavParent":false,"name":"Using Facebook","__isHelpCenterNavigationNode":"HelpCenterNavigationFolder","iconName":"compass","cms_object_id":null,"children":[{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Creating an account","icon_name":"profile","cms_object_id":"570785306433644"},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Your profile","icon_name":"profile-checkmark","cms_object_id":"396528481579093","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1017657581651994","name":"Add and edit your profile info"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1217373834962306","name":"Your profile picture and cover photo"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1640261589632787","name":"Share and manage posts on your profile"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"191128814621591","name":"Fix a problem"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Friending","icon_name":"friend-add","cms_object_id":"1540345696275090","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"246750422356731","name":"Adding friends"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"336320879782850","name":"People you may know"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"273948399619967","name":"Control who can friend and follow you"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1041444532591371","name":"Upload your contacts to Facebook"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1000976436606344","name":"Unfriending or blocking someone"}]},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Facebook Dating","icon_name":"app-facebook-dating","cms_object_id":"312959615934334"},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Your home page","icon_name":"news-feed-home","cms_object_id":"753701661398957","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1155510281178725","name":"How feed works"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"964154640320617","name":"Control what you see in Feed"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1624177224568554","name":"Like and react to posts"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"821153694683665","name":"Search"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1195058957201487","name":"Translate Feed"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"364760868183100","name":"Translate Facebook App"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1056848067697293","name":"Memories"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Messaging","icon_name":"messages","cms_object_id":"1071984682876123","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"487151698161671","name":"Send messages"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1117039378334299","name":"View and manage messages"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"968185709965912","name":"Report a message"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"287631408243374","name":"Video calling"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1024559617598844","name":"Fix a problem"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Stories","icon_name":"stories","cms_object_id":"862926927385914","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"126560554619115","name":"Create and share your story"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"349797465699432","name":"View and reply to stories"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"425367811379971","name":"Page Stories"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Your photos and videos","icon_name":"camera","cms_object_id":"1069521513115444","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1703757313215897","name":"Photos"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1738143323068602","name":"Videos"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"931327837299966","name":"Going live"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"490693151131920","name":"Albums"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"267689476916031","name":"Tagging"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"507253956146325","name":"Fix a problem"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Videos on Watch","icon_name":"watch-tv","cms_object_id":"1041553655923544","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"401287967326510","name":"Watching shows and videos"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"609563009232602","name":"Watch on TV"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"270093216665260","name":"Fix a problem"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Pages","icon_name":"app-pages","cms_object_id":"282489752085908","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1771297453117418","name":"Interact with Pages"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"135275340210354","name":"Create and manage a Page"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1644118259243888","name":"Names and usernames"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1206330326045914","name":"Manage Page settings"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1602483780062090","name":"Customise a Page"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1533298140275888","name":"Publishing"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"994476827272050","name":"Messaging"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"794890670645072","name":"Insights"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"248844142141117","name":"Banning and moderation"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1020132651404616","name":"Fix a problem"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Groups","icon_name":"group","cms_object_id":"1629740080681586","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1686671141596230","name":"Group management for admins"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1210322209008185","name":"Join and interact with groups"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1769476376397128","name":"Resources for Page admins"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1075368719167893","name":"Fix a problem"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Events","icon_name":"calendar","cms_object_id":"1076296042409786","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"572885262883136","name":"Create and manage an event"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1571121606521970","name":"View and respond to events"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Fundraisers and donations","icon_name":"fundraiser","cms_object_id":"833144153745643","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"356680401435429","name":"Creating a fundraiser"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1409509059114623","name":"Donating to a fundraiser"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"332739730519432","name":"Personal fundraisers"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1640008462980459","name":"For charities"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"2725517974129416","name":"Fix a problem"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Payments","icon_name":"app-facebook-pay","cms_object_id":"1434403039959381","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"248471068848455","name":"Game payments"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"863171203733904","name":"Payments in messages"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1409509059114623","name":"Donating to a fundraiser"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1769557403280350","name":"Event tickets"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1737820969853848","name":"Monetisation and payouts"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Marketplace","icon_name":"marketplace","cms_object_id":"1713241952104830","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1889067784738765","name":"How Marketplace works"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"272975853291364","name":"Buying on Marketplace"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"153832041692242","name":"Selling on Marketplace"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"773379109714742","name":"Selling with delivery and checkout on Marketplace"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1411280809160810","name":"Using checkout on Facebook"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"319768015124786","name":"Buy-and-sell groups"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1127970530677256","name":"Get help with Marketplace"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Apps","icon_name":"apps","cms_object_id":"1642635852727373","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"942196655898243","name":"Manage your apps"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1727608884153160","name":"App visibility and privacy"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Facebook Mobile apps","icon_name":"desktop-mobile","cms_object_id":"866249956813928","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1639918076332350","name":"Android app"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1158027224227668","name":"iPhone and iPad apps"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"795302980569545","name":"Facebook Lite app"}]},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Accessibility","icon_name":"accessibility","cms_object_id":"273947702950567"}]},{"__typename":"HelpCenterNavigationFolder","isNavParent":false,"name":"Managing your account","__isHelpCenterNavigationNode":"HelpCenterNavigationFolder","iconName":"profile-facebook","cms_object_id":null,"children":[{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Login and password","icon_name":"key","cms_object_id":"1573156092981768","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1058033620955509","name":"Log in to your account"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"248976822124608","name":"Change your password"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"283100488694834","name":"Fix a problem"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"582999911881572","name":"Uploading your ID"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Account settings","icon_name":"profile-settings","cms_object_id":"239070709801747","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1221288724572426","name":"Adjust your account settings"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1740158369563165","name":"Your username"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"991335594313139","name":"Choose a legacy contact"}]},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Names on Facebook","icon_name":"document-person","cms_object_id":"1090831264320592"},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Notifications","icon_name":"bell","cms_object_id":"1036755649750898","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"530847210446227","name":"Push, email and text notifications"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"269880466696699","name":"Choose what you're notified about"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1719980288275077","name":"Fix a problem"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Ad preferences","icon_name":"ad","cms_object_id":"109378269482053","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"516147308587266","name":"How ads work on Facebook"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1075880512458213","name":"Control the ads you see"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"610457675797481","name":"Your info and Facebook ads"}]},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Accessing and downloading your information","icon_name":"info-circle","cms_object_id":"1701730696756992"},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Deactivating or deleting your account","icon_name":"cross-circle","cms_object_id":"250563911970368"}]},{"__typename":"HelpCenterNavigationFolder","isNavParent":false,"name":"Privacy, safety and security","__isHelpCenterNavigationNode":"HelpCenterNavigationFolder","iconName":"privacy","cms_object_id":null,"children":[{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Your privacy","icon_name":"privacy","cms_object_id":"238318146535333","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1297502253597210","name":"Control who can see what you share"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"504765303045427","name":"Manage what you've shared"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1718866941707011","name":"Control who can find you"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Staying safe","icon_name":"life-preserver","cms_object_id":"592679377575472","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"726709730764837","name":"Abuse resources"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1553737468262661","name":"Suicide and self-injury resources"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"141874516227713","name":"Crisis Response"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1079477105456277","name":"Safety resources for parents"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"764592980307837","name":"Info for law enforcement"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Keeping your account secure","icon_name":"shield","cms_object_id":"235353253505947","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"285695718429403","name":"Security features and tips"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"909243165853369","name":"Login alerts and two-factor authentication"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1584206335211143","name":"Avoid spam and scams"}]},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Shopping safety","icon_name":"shopping-bag-heart","cms_object_id":"236079651241697","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"123884166448529","name":"Tips for shopping safely"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1599248863596914","name":"Purchase with confidence"}]}]},{"__typename":"HelpCenterNavigationFolder","isNavParent":false,"name":"Policies and reporting","__isHelpCenterNavigationNode":"HelpCenterNavigationFolder","iconName":"report","cms_object_id":null,"children":[{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Reporting abuse","icon_name":"report","cms_object_id":"1753719584844061","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1380418588640631","name":"How to report things"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1723400564614772","name":"Don't Have an Account?"}]},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Reporting a problem with Facebook","icon_name":"bug","cms_object_id":"1126628984024935"},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Being your authentic self on Facebook","icon_name":"document-person","cms_object_id":"186614050293763"},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Reporting a privacy violation","icon_name":"privacy-unlocked","cms_object_id":"1561472897490627"},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Hacked and fake accounts","icon_name":"contact","cms_object_id":"1216349518398524"},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Managing a deceased person's account","icon_name":"flower","cms_object_id":"275013292838654","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"241237032913527","name":"Legacy contacts"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1017717331640041","name":"About memorialised accounts"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1111566045566400","name":"Request to memorialise or remove an account"}]},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"Legal removal request","icon_name":"shield","cms_object_id":"2214522878809427"},{"__typename":"HelpCenterNavigationAboutPage","__isHelpCenterNavigationNode":"HelpCenterNavigationAboutPage","isNavParent":false,"name":"Intellectual property","icon_name":"copyright","cms_object_id":"399224883474207","children":[{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"1020633957973118","name":"Copyright"},{"__typename":"HelpCenterNavigationPage","isNavParent":false,"cmsID":"507663689427413","name":"Trademark"}]},{"__typename":"HelpCenterNavigationPage","__isHelpCenterNavigationNode":"HelpCenterNavigationPage","isNavParent":false,"name":"About our policies","icon_name":"documents","cms_object_id":"1735443093393986"}]}]}},"headerInstance":{"__typename":"FacebookHelpCenterHeaderConfig","selectedLanguage":"English (UK)","userLocale":"en_GB","showHeaderSearch":false,"__isHelpCenterHeaderConfig":"FacebookHelpCenterHeaderConfig","inbox_uri":"\/support\/","selected_language":"English (UK)","show_fb_settings_dropdown":false,"profile_link":null,"header_theme":"PRIMARY","header_language_button_theme":"SECONDARY"},"footerInstance":{"__typename":"HelpCenterFooterConfigBase","__isHelpCenterFooterConfig":"HelpCenterFooterConfigBase","footerLinks":[{"title":"About","uri":"https:\/\/about.facebook.com\/?utm_source=help-center"},{"title":"Privacy","uri":"https:\/\/www.facebook.com\/privacy\/explanation\/"},{"title":"Terms and policies","uri":"https:\/\/www.facebook.com\/policies\/"},{"title":"Ad choices","uri":"https:\/\/www.facebook.com\/help\/568137493302217\/"},{"title":"Careers","uri":"https:\/\/www.facebook.com\/careers\/"},{"title":"Cookies","uri":"https:\/\/www.facebook.com\/policies\/cookies\/"},{"title":"Create ad","uri":"https:\/\/www.facebook.com\/business\/"},{"title":"Create Page","uri":"https:\/\/www.facebook.com\/pages\/creation\/"}],"attribution_image_source":"https:\/\/static.xx.fbcdn.net\/rsrc.php\/v3\/yM\/r\/HAhr_ppQVQg.png","trademark_name":"Meta"},"feedbackInstance":{"__typename":"HelpCenterFeedbackConfigBase","__isHelpCenterFeedbackConfig":"HelpCenterFeedbackConfigBase","feedback_config":{"disclaimer":"Bear in mind that this form is for feedback only and you won't receive a reply. Please don't include personal information about you or someone else. Learn more about how to","disclaimer_link":{"text":"report something to Facebook.","uri":"\/help\/1380418588640631"},"confirmation_body":"Your feedback helps improve this answer for everyone.","confirmation_header":"Thanks","custom_first_question":"Was this helpful?","negative_answers":["The information is confusing","The solution doesn't work","I don't like the product or policy","Other"],"positive_question":"How could it be better?","negative_question_say_more":"Can you say more?","negative_question_what_went_wrong":"What went wrong?"},"close_on_submit":true,"hide_close_button":false},"cookies":{"__typename":"HelpCenterCookiesConfigBase","cookies":[]},"home_content_instance":{"__typename":"FacebookHelpCenterHomeContent","__isHelpCenterHomeContentWithPopularTopics":"FacebookHelpCenterHomeContent","popularTopics":[{"description":"Adjust settings, manage notifications, learn about name changes and more.","image_path":"https:\/\/static.xx.fbcdn.net\/assets\/?revision=816167972411634&name=desktop-names-on-facebook-icon&density=1","link":{"title":"Account Settings","cms_id":"239070709801747"}},{"description":"Fix login issues and learn how to change or reset your password.","image_path":"\/images\/help\/fbhc_redesign\/card_images\/loginandpassword.png","link":{"title":"Login and Password","cms_id":"1573156092981768"}},{"description":"Control who can see what you share and add extra protection to your account.","image_path":"\/images\/help\/fbhc_redesign\/card_images\/yourprivacy.png","link":{"title":"Privacy and Security","cms_id":"238318146535333"}},{"description":"Learn how to buy and sell things on Facebook.","image_path":"\/images\/help\/fbhc_redesign\/card_images\/marketplace.png","link":{"title":"Marketplace","cms_id":"1713241952104830"}},{"description":"Learn how to create, manage and use Groups.","image_path":"https:\/\/static.xx.fbcdn.net\/assets\/?revision=816167972411634&name=desktop-groups-icon&density=1","link":{"title":"Groups","cms_id":"1629740080681586"}},{"description":"Learn how to create, use, follow and manage a Page.","image_path":"\/images\/help\/fbhc_redesign\/card_images\/pages.png","link":{"title":"Pages","cms_id":"282489752085908"}}],"__isHelpCenterHomeContentWithLoginHelp":"FacebookHelpCenterHomeContent","login_help":{"cms_id":"1573156092981768","description":"Learn what to do if you're having trouble with getting back on Facebook.","label":"Get Help","title":"Need help with logging in?"},"__isHelpCenterHomeContentWithCheckpointHelp":"FacebookHelpCenterHomeContent","checkpoint_help":null,"__isHelpCenterHomeContentWithExternalLinks":"FacebookHelpCenterHomeContent","externalLinks":{"title":"Looking for something else?","externalLink":[{"title":"Visit Business Help Centre","url":"https:\/\/www.facebook.com\/business\/help\/","image_uri":"https:\/\/static.xx.fbcdn.net\/rsrc.php\/v3\/yQ\/r\/H9vBLN-6Zsk.png","subtitle":"Learn more about promoting your business on Facebook"}]},"__module_operation_HelpCenterHomePage_config":{"__dr":"FacebookHelpCenterHomeContent_content$normalization.graphql"},"__module_component_HelpCenterHomePage_config":{"__dr":"FacebookHelpCenterHomeContent.react"},"cms_id":"700514180564304"}}},"extensions":{"is_final":true}},"sequence_number":0,"variables":{"helpIdentifier":"FACEBOOK"},"extra_context":null}}]],["HelpCenterMobileLoginHelp.react"],["HelpCenterMobileTopicCard.react"],["RequireDeferredReference","unblock",[],[["FacebookHelpCenterHomeContent_content$normalization.graphql","FacebookHelpCenterHomeContent.react","CometTooltipDeferredImpl.react","HelpCenterMobileLoginHelp.react","HelpCenterMobileTopicCard.react"],"sd"]],["RequireDeferredReference","unblock",[],[["FacebookHelpCenterHomeContent_content$normalization.graphql","FacebookHelpCenterHomeContent.react","CometTooltipDeferredImpl.react","HelpCenterMobileLoginHelp.react","HelpCenterMobileTopicCard.react"],"css"]]]});});});'''
  10.  
  11. # --- find start of `"__bbox":{ ... }` ---
  12.  
  13. start = text.find('__bbox":') + len('__bbox":')
  14. print('start:', start)    
  15.  
  16. #print('text[-10:+10]:', text[start-10:start+10])
  17.  
  18. # --- count `{` and `}` to find end of `"__bbox":{ ... }` ---
  19.  
  20. count = 0
  21. for end, char in enumerate(text[start:], start):
  22.     if char == '{':
  23.         count += 1
  24.     if char == '}':
  25.         count -= 1
  26.     if count == 0:
  27.         break
  28. print('end:', end)    
  29.  
  30. # --- convert JSON string to Python structure (dict/list) ---
  31.    
  32. data = json.loads(text[start:end+1])
  33. #pp.pprint(data)
  34.  
  35. # --- use recursion to find all 'cms_object_id', 'cmsID', 'name' ---
  36.  
  37. def search(data):
  38.     if isinstance(data, dict):
  39.         found = False
  40.         if 'cms_object_id' in data:
  41.             print('cms_object_id', data['cms_object_id'])
  42.             found = True
  43.         if 'cmsID' in data:
  44.             print('cmsID', data['cmsID'])
  45.             found = True
  46.         if 'name' in data:
  47.             print('name', data['name'])
  48.             found = True
  49.         if found:
  50.             print('---')
  51.         for val in data.values():
  52.             search(val)
  53.     if isinstance(data, list):
  54.         for val in data:
  55.             search(val)
  56.  
  57. print('--- search ---')        
  58. search(data)        
RAW Paste Data Copied