instascrape icon indicating copy to clipboard operation
instascrape copied to clipboard

requests lib throwing `Invalid value NaN (not a number)` Error

Open Cherchercher opened this issue 2 years ago • 1 comments

Looks to me the HTML content is not returned hence the len is null...?

Value error processing url https://www.instagram.com/p/COSfR9mh4WN/ Invalid value NaN (not a number)

Traceback (most recent call last): post.scrape(headers=headers) File "/usr/local/lib/python3.9/site-packages/instascrape/scrapers/post.py", line 73, in scrape return_instance = super().scrape( File "/usr/local/lib/python3.9/site-packages/instascrape/core/_static_scraper.py", line 144, in scrape return_data = self._get_json_from_source(self.source, headers=headers, session=session) File "/usr/local/lib/python3.9/site-packages/instascrape/core/_static_scraper.py", line 244, in _get_json_from_source html = self._html_from_url(url=url, headers=headers, session=session) File "/usr/local/lib/python3.9/site-packages/instascrape/core/_static_scraper.py", line 285, in _html_from_url response = session.get(url, headers=headers) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 555, in get return self.request('GET', url, **kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request six.raise_from(e, None) File "", line 3, in raise_from File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request httplib_response = conn.getresponse() File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1371, in getresponse response.begin() File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 319, in begin version, status, reason = self._read_status() File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 280, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 704, in readinto return self._sock.recv_into(b) File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1099, in read return self._sslobj.read(len, buffer)

Cherchercher avatar Feb 14 '22 07:02 Cherchercher

I do we solve using this library

kareemrasheed89 avatar May 13 '22 03:05 kareemrasheed89