instascrape icon indicating copy to clipboard operation
instascrape copied to clipboard

ValueError while Scrapping Posts

Open InzamamAnwar opened this issue 2 years ago • 9 comments

Describe the bug Scrapping post using Post method gives error.

Traceback (most recent call last):
  File "/instagram-scrapping/main.py", line 23, in <module>
    post.scrape(headers=headers)
  File "lib/python3.7/site-packages/instascrape/scrapers/post.py", line 88, in scrape
    return_instance.upload_date = datetime.datetime.fromtimestamp(return_instance.timestamp)
ValueError: Invalid value NaN (not a number)

To Reproduce Steps to reproduce the behavior:

from instascrape import Post

headers = {'user-agent': '', 'cookie': 'sessionid:{SESSION_ID}'}

post = Post("https://www.instagram.com/p/CaDMviujr4q/")
post.scrape(headers=headers)

Expected behavior Dictionary with Keys mentioned in Wiki-Scrapped Data points

Desktop (please complete the following information):

  • OS: [Ubuntu 18.04 LTS]
  • Browser [chrome]
  • Version [insta-scrape: 2.1.2, chrome: 98.0.4758.80, Python: 3.7.11]

InzamamAnwar avatar Feb 17 '22 11:02 InzamamAnwar

@89z Thank You for your prompt reply, But I was looking solution(s) in Python.

InzamamAnwar avatar Feb 18 '22 04:02 InzamamAnwar

I have an alternate package that works:

package main
import "github.com/89z/mech/instagram"

func main() {
   login, err := instagram.NewLogin(username, password)
   if err != nil {
      panic(err)
   }
   items, err := login.Items("CaDMviujr4q")
   if err != nil {
      panic(err)
   }
   for _, item := range items {
      println(item.Caption.Text)
   }
}

where is this suppose to go ?

Lxand3r avatar Feb 20 '22 19:02 Lxand3r

I have the same problem.

Jay-flow avatar Mar 17 '22 01:03 Jay-flow

I have the same problem as well

akouirouk avatar Mar 19 '22 01:03 akouirouk

Me too, I have tired with the example script for joebien, get the same error.

UmeSiyah avatar Mar 20 '22 15:03 UmeSiyah

Likewise

gentzeng avatar Mar 20 '22 16:03 gentzeng

I have the same problem as well

Chocomagma avatar Apr 29 '22 03:04 Chocomagma

I have the same problem as well

Chocomagma avatar Apr 29 '22 03:04 Chocomagma

same issue

Suizer avatar May 13 '22 03:05 Suizer