I have downloaded the "about section" for some facebook pages using request.get and have been scraping off the coordinates from the mini-map on the page using the following code:
html = open(file, "r",encoding='utf-8').read() # Opening saved html
soup = BeautifulSoup(html,'html.parser') # Parsing html
map_url = soup.find_all(class_='_a3f img') # Extracting url of map
parsed =urlparse.urlparse(map_url['src']) # Extracting url parameters
coordinate_marker = parse_qs(parsed.query)['markers'] # Return coordinates
This has worked well, apart from a few instances. In these instances, the saved html still has a map, and '_a3f img' in str(soup) returns True, it just isn't returning anything with 'find_all'.
What's stranger, is when I open the saved HTML in Chrome, copy and paste the entire HTML into a new file - that then runs fine and returns the coordinates (both files are the same size).
I have tried changing the parser (no luck). Any explanation for this would be greatly appreciated!